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

Frank Warmerdam warmerdam at POBOX.COM
Wed Sep 21 12:42:25 EDT 2005

On 9/21/05, Tamas Szekeres <szekeres.tamas at> 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.


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
light and sound - activate the windows |
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the mapserver-dev mailing list