mapscript jvm crash on removeLayer
Tamas Szekeres
szekerest at GMAIL.COM
Fri Sep 8 04:09:12 PDT 2006
Hi,
This issue may be similar to the C# problem described in
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1743
Would you try to use insertLayer instead of "new layerObj(mapObj)".?
There's no use to delete the subsequent objects (like classObj,
styleObj) of the layer manually.
Tamas
2006/9/8, mikiet <mike.talbutt at dottedeyes.com>:
> Hi,
>
> I am using java mapscript in an application. I have the requirement to add
> annotations to an inline layer, and remove annotations from an inline layer.
>
> I beleive removing annotations from an inline layer is not availble in
> mapscript so as a work around I wanted to create a new layer with all the
> features from my inline layer except the one I wanted to remove, then remove
> the old layer (Hope that makes sense !).
>
> Unfortunatly when I try and remove my old layer from the map the jvm crashes
> taking down the tomcat process.
>
> From the entry 'Java VM Crashes using the Mapscript API' I can see a few
> people have had simillar problems and its being put down to a garbage
> collection problems in the jvm. The post states you should call the delete
> method on a classObj when it is no longer used, I have tried this but its
> not got rid of the problem. Can anyone point me in the right direction
> please
>
> My code is below...
>
> layerObj annLayer = mapobject.getLayerByName(sLayerName);
> layerObj newannLayer = new layerObj(mapobject);
> int featureCounter = 0;
> while (featureCounter < annLayer.getNumFeatures()){
> shapeObj shape2 = annLayer.getFeature( featureCounter ,-1);
> if (shape2.getValue(1).equals(sName)){
> System.out.println("retreived shape index - " +
> shape2.getIndex());
> System.out.println("retreived shape - " +
> shape2.getValue(1));
> }
> else{
> System.out.println("adding feature to new layer " +
> shape2.getValue(1));
> newannLayer.addFeature(shape2);
> }
> featureCounter++;
> }
> annLayer.getClass(0).getStyle(0).delete();
> annLayer.getClass(0).delete();
> annLayer.delete();
> mapobject.removeLayer(annLayer.getIndex());
> newannLayer.setName(sLayerName);
> --
> View this message in context: http://www.nabble.com/mapscript-jvm-crash-on-removeLayer-tf2238325.html#a6206628
> Sent from the Mapserver - User forum at Nabble.com.
>
More information about the MapServer-users
mailing list