Usage of different heaps causes memory leak with SWIG C# on
Win32
Tamas Szekeres
szekeres.tamas at FREEMAIL.HU
Wed Sep 21 17:06:38 EDT 2005
Frank,
That could help! However, the mapscript makefile might be modified
accordingly.
May I suspect mapscript will work only if the following conditions are met
when compiling libmap.dll and mapscript.dll:
1. CRT is used with dll (not statically linked)
2. Both of the modules use the same version (eg. msvcrt.dll or
msvcr71.dll), suggested to compile with the same compiler version.
May this issue be a problem with other modules such as gdal13.dll,
bgd.dll, proj.dll etc.
I think, the safest solution would be ensuring malloc and free to occur in
the same module programatically.
Tamas
On Wed, 21 Sep 2005 12:42:25 -0400, Frank Warmerdam <warmerdam at POBOX.COM>
wrote:
>On 9/21/05, Tamas Szekeres <szekeres.tamas at freemail.hu> wrote:
>> Hi list!
>>
>> Calling mapObj.GetProjection() causes unexpected break using the debug
>> build of SWIG mapscript with C# (Invalid Address specified to
RtlFreeHeap).
>>
>> The reason of the problem is that the returned string allocated in
>> libmap.dll and freed in mapscript.dll using different heaps with CRT.
>>
>> The resulting behaviour is that the returning string will not be freed
at
>> all.
>>
>> This issue applies to all off the functions passing memory blocks using
>> this way.
>>
>> This problem could be resolved by replacing free() to msFree() in
>> CSharp_mapObj_getProjection, but a more general soution would be
expected.
>
>Tamas,
>
>I would think a more general solution would be to build both using
>MSVCRT.DLL (ie. the /MD flag).
>
>Best regards,
>
>--
>---------------------------------------+----------------------------------
----
>I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at pobox.com
>light and sound - activate the windows | http://pobox.com/~warmerdam
>and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the mapserver-dev
mailing list