[mapguide-commits] r6610 - in sandbox/adsk/2.4j/Oem/SWIGEx:
Source/Modules Win32
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu May 3 22:37:40 EDT 2012
Author: hubu
Date: 2012-05-03 19:37:39 -0700 (Thu, 03 May 2012)
New Revision: 6610
Modified:
sandbox/adsk/2.4j/Oem/SWIGEx/Source/Modules/java.cxx
sandbox/adsk/2.4j/Oem/SWIGEx/Win32/Swig.exe
Log:
On behalf of Andy Zhang.
Fix ticket #1960 in 2.4j: ByteSource and ByteReader memory leak in Java Api
The generated Java method MgByteSource::GetReader() is like below:
public MgByteReader GetReader() throws MgException {
long cPtr = MapGuideJavaApiJNI.MgByteSource_GetReader(swigCPtr);
return (cPtr == 0) ? null : (MgByteReader)ObjectFactory.createObject(MapGuideJavaApiJNI.getClassId(cPtr), cPtr, false);
}
The last parameter indicated whether the object owns memory itself. In Java API, it is always false. That means it will not call MapGuideJavaApiJNI.delete_MgByteReader(swigCPtr) when deleting the object, which results in memory leak.
Now change the last parameter to 'true' to fix this issue. The change is consistant with CSharp.
Modified: sandbox/adsk/2.4j/Oem/SWIGEx/Source/Modules/java.cxx
===================================================================
--- sandbox/adsk/2.4j/Oem/SWIGEx/Source/Modules/java.cxx 2012-05-03 14:38:06 UTC (rev 6609)
+++ sandbox/adsk/2.4j/Oem/SWIGEx/Source/Modules/java.cxx 2012-05-04 02:37:39 UTC (rev 6610)
@@ -2000,7 +2000,7 @@
addThrows(n, "tmap:javaout", n);
if(returnObject)
{
- Replaceall(tm, "new $javaclassname(cPtr, $owner)", "($javaclassname)ObjectFactory.createObject($module.getClassId(cPtr), cPtr, $owner)");
+ Replaceall(tm, "new $javaclassname(cPtr, $owner)", "($javaclassname)ObjectFactory.createObject($module.getClassId(cPtr), cPtr, true)");
Replaceall(tm, "$module", imclass_name);
}
if (Getattr(n,"feature:new"))
Modified: sandbox/adsk/2.4j/Oem/SWIGEx/Win32/Swig.exe
===================================================================
(Binary files differ)
More information about the mapguide-commits
mailing list