in reply to Re: Memory leak when using hash 'references'
in thread Memory leak when using hash 'references'
the above program gives back the memory to the system, and top shows no abnormal memory usage. Removing the second loop results in an approxmiately 40MB memory usage.#include <stdio.h> #include <stdlib.h> #include <unistd.h> void main (void ) { int *a[10000]; long c = 0; do { a[c] = new int[1000] ; } while ( c++ < 10001 ); c = 0; do { delete a[c]; } while ( c++ < 10001 ); sleep( 20 ); }
I tested this on Redhat 7.3 (2.4.18-3) gcc version 2.96 20000731
edited: Mon May 5 14:02:53 2003 by jeffa - code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Memory leak when using hash 'references'
by Tanalis (Curate) on May 05, 2003 at 05:49 UTC |