l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Apr 29 10:38

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] not freeing heap memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] not freeing heap memory

Peter Jay Salzman wrote:

> when you don't free memory allocated allocated from the heap on a linux
> system, the memory is recovered after the application ends.

Yes. Try this with "top" running in another window, and watch the
used memory decline and then jump back. "Garbage collection"
is like playing with your toys and then leaving your room and
returning with everything put away.

#include <stdio.h>
#define MEMORY_BLOCK 1048576

int main()
        int i;
        long total = 0;

        for( i = 0; malloc( MEMORY_BLOCK ); i++ )
                printf( "total = %ld\n", total += MEMORY_BLOCK );
                if ( !(i % 100 ) ) sleep( 1 );
        exit( 0 );

> are there any operating systems where the memory is only recovered after
> a reboot?

Definitely Windows 3.1 and before, but I'm still seeing advertisements
for memory leak utilities in computer magazines.

> pete
> --
> GPG Instructions: http://www.dirac.org/linux/gpg
> GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.