[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netCDF #PKT-462504]: Re: [netcdfgroup] netcdf-4 open/close memory leak
- Subject: [netCDF #PKT-462504]: Re: [netcdfgroup] netcdf-4 open/close memory leak
- Date: Mon, 14 Dec 2009 17:12:18 -0700
>
> Hi, Ed,
>
> I installed valgring and ran the tests (on OS X) on a 32-bit compile
> with -g -O0 (for both hdf5 and netcdf), and the netcdf "make check"
> didn't find any problems. Nor does valgrind find any errors with Jeff
> Whitaker's simple program (attached, along with his test netcdf
> files). But if the iteration count is large enough to keep the
> program running for a while, top clearly shows the memory usage
> climbing about linearly with time. The memory usage goes up for both
> 32 and 64 bit compilations, for what it's worth.
>
> I don't have much experience with hdf5, but I did modify the hdf5
> example program "h5_read" to run in a big loop (with no printing and
> everything stripped out execept H5Fopen/H5Fclose), and it doesn't show
> any obvious leakage in top.
>
> -- Ted
>
>
Howdy Ted!
I have been looking into memory issues. I have changed libsrc4/tst_files2.c to
get some actual numbers, but I wonder if you might want to try calling this
function in some of your code to see what results you get:
/* This function uses the ps command to find the amount of memory in
use by the process. From the ps man page:
size SZ approximate amount of swap space that would be required if
the process were to dirty all writable pages and then be
swapped out. This number is very rough!
*/
void
get_mem_used(int *mem_used)
{
char cmd[NC_MAX_NAME + 1];
char blob[MAX_LEN + 1];
FILE *fp;
int num_char;
sprintf(cmd, "ps -o size= %d > %s", getpid(), TMP_FILE_NAME);
system(cmd);
if (!(fp = fopen(TMP_FILE_NAME, "r"))) ERR;
num_char = fread(blob, MAX_LEN, 1, fp);
sscanf(blob, "%d", mem_used);
fclose(fp);
unlink(TMP_FILE_NAME);
}
Ticket Details
===================
Ticket ID: PKT-462504
Department: Support netCDF
Priority: Critical
Status: Closed