[mapserver-commits] r7218 -
trunk/mapserver/mapscript/csharp/examples
svn at osgeo.org
svn at osgeo.org
Thu Dec 27 11:48:12 EST 2007
Author: tamas
Date: 2007-12-27 11:48:12 -0500 (Thu, 27 Dec 2007)
New Revision: 7218
Modified:
trunk/mapserver/mapscript/csharp/examples/RFC24.cs
Log:
Force the destruction because of the constructor overload causes delayed garbage collection with Mono on Windows.
Modified: trunk/mapserver/mapscript/csharp/examples/RFC24.cs
===================================================================
--- trunk/mapserver/mapscript/csharp/examples/RFC24.cs 2007-12-26 23:34:00 UTC (rev 7217)
+++ trunk/mapserver/mapscript/csharp/examples/RFC24.cs 2007-12-27 16:48:12 UTC (rev 7218)
@@ -165,8 +165,9 @@
layerObj newLayer=new layerObj(map);
layerObj reference = map.getLayer(map.numlayers-1);
- assert(reference.refcount == 3, "testLayerObjDestroy precondition");
- newLayer=null;
+ assert(newLayer.refcount == 3, "testLayerObjDestroy precondition");
+ newLayer.Dispose(); // force the destruction for Mono on Windows because of the constructor overload
+ newLayer = null;
gc();
assert(reference.refcount == 2, "testLayerObjDestroy");
}
@@ -189,7 +190,8 @@
map.insertLayer(newLayer,0);
layerObj reference = map.getLayer(0);
- assert(reference.refcount == 3, "testInsertLayerObjDestroy precondition");
+ assert(newLayer.refcount == 3, "testInsertLayerObjDestroy precondition");
+ newLayer.Dispose(); // force the destruction for Mono on Windows because of the constructor overload
newLayer=null;
gc();
assert(reference.refcount == 2, "testInsertLayerObjDestroy");
@@ -223,7 +225,8 @@
layerObj newLayer=map.getLayer(1);
layerObj reference = map.getLayer(1);
- assert(reference.refcount == 3, "testGetLayerObjDestroy precondition");
+ assert(newLayer.refcount == 3, "testGetLayerObjDestroy precondition");
+ //newLayer.Dispose(); // force the destruction needed for Mono on Windows
newLayer=null;
gc();
assert(reference.refcount == 2, "testGetLayerObjDestroy");
@@ -245,7 +248,8 @@
layerObj newLayer=map.getLayerByName("POLYGON");
layerObj reference=map.getLayerByName("POLYGON");
- assert(reference.refcount == 3, "testGetLayerObjByNameDestroy precondition");
+ assert(newLayer.refcount == 3, "testGetLayerObjByNameDestroy precondition");
+ //newLayer.Dispose(); // force the destruction needed for Mono on Windows
newLayer=null;
gc();
assert(reference.refcount == 2, "testGetLayerObjByNameDestroy");
@@ -269,7 +273,8 @@
classObj newClass=new classObj(layer);
classObj reference=layer.getClass(layer.numclasses-1);
- assert(reference.refcount == 3, "testClassObjDestroy precondition");
+ assert(newClass.refcount == 3, "testClassObjDestroy precondition");
+ newClass.Dispose(); // force the destruction for Mono on Windows because of the constructor overload
map=null; layer=null; newClass=null;
gc();
assert(reference.refcount == 2, "testClassObjDestroy");
@@ -295,7 +300,8 @@
styleObj newStyle=new styleObj(classobj);
styleObj reference=classobj.getStyle(classobj.numstyles-1);
- assert(reference.refcount == 3, "testStyleObjDestroy");
+ assert(newStyle.refcount == 3, "testStyleObjDestroy");
+ newStyle.Dispose(); // force the destruction for Mono on Windows because of the constructor overload
map=null; layer=null; classobj=null; newStyle=null;
gc();
assert(reference.refcount == 2, "testStyleObjDestroy");
@@ -335,7 +341,8 @@
layer.insertClass(newClass,0);
classObj reference = layer.getClass(0);
- assert(reference.refcount == 3, "testInsertClassObjDestroy precondition");
+ assert(newClass.refcount == 3, "testInsertClassObjDestroy precondition");
+ newClass.Dispose(); // force the destruction for Mono on Windows because of the constructor overload
map=null; layer=null; newClass=null;
gc();
assert(reference.refcount == 2, "testInsertClassObjDestroy");
@@ -378,7 +385,8 @@
classobj.insertStyle(newStyle,0);
styleObj reference = classobj.getStyle(0);
- assert(reference.refcount == 3, "testInsertStyleObjDestroy precondition");
+ assert(newStyle.refcount == 3, "testInsertStyleObjDestroy precondition");
+ newStyle.Dispose(); // force the destruction for Mono on Windows because of the constructor overload
map=null; layer=null; classobj=null; newStyle=null;
gc();
assert(reference.refcount == 2, "testInsertStyleObjDestroy");
@@ -402,7 +410,7 @@
classObj newClass=layer.getClass(0);
classObj reference = layer.getClass(0);
- assert(reference.refcount == 3, "testGetClassObjDestroy precondition");
+ assert(newClass.refcount == 3, "testGetClassObjDestroy precondition");
map=null; layer=null; newClass=null;
gc();
assert(reference.refcount == 2, "testGetClassObjDestroy");
@@ -428,7 +436,7 @@
styleObj style=classobj.getStyle(0);
styleObj reference=classobj.getStyle(0);
- assert(reference.refcount == 3, "testGetStyleObjDestroy precondition");
+ assert(style.refcount == 3, "testGetStyleObjDestroy precondition");
map=null; layer=null; classobj=null; style=null;
gc();
assert(reference.refcount == 2, "testGetStyleObjDestroy");
More information about the mapserver-commits
mailing list