[gdal-dev] General Memory/Resource leak fixes(Cleanup calls)

sanjay boddhu sanjay_ieee at yahoo.com
Thu Jan 24 14:44:08 EST 2008


Hi Martin,
              I did try calling all the below cleanup calls:

VSICleanupFileManager();
GDALDestroyDriverManager();
CPLCleanupTLS();
CPLFinderClean();
CPLFreeConfig();

But i  still have the leak with call stack showing the below order(poiting to VSIMalloc):

Type    Quantity    Total (bytes)    Allocation Location    Sequence

Leak exiting program    1    4    gdal14.dll, cpl_vsisimple.cpp, VSIMalloc - line 280    52
  Memory Leak Exiting Program: Address 0x04266CF8 (4) allocated by malloc.

Allocation Call Stack - Thread 0 [0x0CA0]
VSIMalloc    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_vsisimple.cpp    280
CPLMalloc    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_conv.cpp    127
GTiffCreate    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\frmts\gtiff\geotiff.cpp    3568
Create    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\frmts\gtiff\geotiff.cpp    3640
Create    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\gcore\gdaldriver.cpp    109

and the resource leaks are(one of the mutex) looks like:

Type    Quantity    Deallocator    Allocation Location    Sequence

CreateMutexA    1    CloseHandle    gdal14.dll, cpl_multiproc.cpp, CPLCreateMutex - line 457    53
  Resource Leak Exiting Program: Handle 0x00000110 allocated by CreateMutexA.

Allocation Call Stack - Thread 0 [0x0CA0]
CPLCreateMutex    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_multiproc.cpp    457
CPLCreateOrAcquireMutex    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_multiproc.cpp    117
CPLMutexHolder    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_multiproc.cpp    63
GetGDALDriverManager    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\gcore\gdaldrivermanager.cpp    72
GDALAllRegister    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\frmts\gdalallregister.cpp    73

And TLSAlloc leak looks like:

Type    Quantity    Deallocator    Allocation Location    Sequence

TlsAlloc    1    TlsFree    gdal14.dll, cpl_multiproc.cpp, CPLGetTLSList - line 642    58
  Resource Leak Exiting Program: Handle 0x00000021 allocated by TlsAlloc.

Allocation Call Stack - Thread 0 [0x0CA0]
CPLGetTLSList    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_multiproc.cpp    642
CPLGetTLS    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_multiproc.cpp    954
CPLGetStaticResult    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_path.cpp    55
CPLGetDirname    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\port\cpl_path.cpp    165
AutoLoadDrivers    c:\documents and settings\sboddhu\desktop\gdal142\gdal-1.4.2\gcore\gdaldrivermanager.cpp    553

Sorry to dump the call stack..but if martin/someone can find any obvious mistake/ missing something in my calling the cleanup calls that would be helpful.

Thanks
Sanjay

mchapman at texelinc.com wrote: Not sure if this is it but are you calling GDALCleanupAll?  It's called that or GDALAllCleanup or something.  I think it is declared near GDALRegisterAll.  

Martin

Sent via BlackBerry by AT&T

-----Original Message-----
From: sanjay boddhu 

Date: Thu, 24 Jan 2008 01:41:45 
To:gdal-dev at lists.osgeo.org
Subject: [gdal-dev] General Memory/Resource leak fixes(Cleanup calls)


Hi ,
     I have been trying to fix (or to be more appropriate, find the cleanup calls to fix) the memory and resource leaks in my application(which uses GDAL to read and write to a tif file). I have tried all the cleanup calls mentioned in the end of :

http://www.gdal.org/gdalinfo.c.html

and reduced lot of memory/resource leaks......But i still get a memory leak pointing in "GDALDataset  Create( ...)"  and few resource leaks of Mutex and TLsAlloc. 

I would really appreciate if anyone can recommend the right cleanup calls for the above leaks or hint me in the right direction.

Thanks

Sanjay



"If you look at what you do not have in life, you don't have anything"
"If you look at what you have in life, you have everything"
 
----------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.  _______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev



"If you look at what you do not have in life, you don't have anything"
"If you look at what you have in life, you have everything"
       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080124/f1f5b5f4/attachment.html


More information about the gdal-dev mailing list