Usage of different heaps causes memory leak with SWIG C# on Win32

Tamas Szekeres szekeres.tamas at FREEMAIL.HU
Wed Sep 21 11:45:21 EDT 2005


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 Szekeres



More information about the mapserver-dev mailing list