Memory leak when opening and closing a file

Hi everyone,
I’m using the SD interface and I have detected that there are memory leftovers after closing the file.
Calling SDstart allocates some memory(~1.5 MB) but the corresponding SDend frees only about 60% of that memory. Is there anything else I can do?

char hdfFile[40]="clavrx_H08_20180913_0530.level2.hdf";
int fileId;
fileId=SDstart(hdfFile, DFACC_READ);
SDend(fileId); //after this call the memory is not entirely freed

Hello Vladmircan,

Would you let us know which version of the HDF4 you’re using? Also, please send a small program that reproduces the problem when you have a chance.


I am using version 4.2.14. I have also edited my post to show an example of what I’m experiencing.

Thank you, Vladmircan. We’ll look into this.

@vladmircan, it may not be relevant to you anymore, but it appears that this memory leak has been fixed in the latest version of HDF4.

valgrind --leak-check=full --show-reachable=yes forum-4875
==19450== Memcheck, a memory error detector
==19450== Copyright (C) 2002-2017, and GNU GPL’d, by Julian Seward et al.
==19450== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==19450== Command: forum-4875
==19450== HEAP SUMMARY:
==19450== in use at exit: 0 bytes in 0 blocks
==19450== total heap usage: 309 allocs, 309 frees, 49,882 bytes allocated
==19450== All heap blocks were freed – no leaks are possible
==19450== For lists of detected and suppressed errors, rerun with: -s
==19450== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)