[mapserver-users] System.AccessViolationException on mapscriptPINVOKE.delete_symbolObj

Huotari, John B (RCIS) John.Huotari at RCIS.com
Tue Dec 4 15:34:04 PST 2012


I'm using C Sharp MapScript to access MapServer (MS4W 3.0.6).  I'm creating a new mapObj from an almost empty MAPFILE and then dynamically add layers to the map and then calling draw to generate an image.  I'm also dynamically adding symbolObjs to the map's symbolset for the layers to reference.  This all works great the vast majority of the time, but on rare occasions, sometime after the map has been generated, I receive the following AccessViolationException when garbage collection is attempting to clean up the MapServer objects.

System.AccessViolationException was unhandled
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=mapscript_csharp
  StackTrace:
       at OSGeo.MapServer.mapscriptPINVOKE.delete_symbolObj(HandleRef jarg1)
       at OSGeo.MapServer.symbolObj.Dispose()
       at OSGeo.MapServer.symbolObj.Finalize()
  InnerException:


I've tried disposing of the map itself, its symbolset, as well as each symbolObj item in that symbolset by calling Dispose on each, but doing so neither causes the error to happen immediately upon calling Dispose (instead it still only happens when garbage collection runs) nor does it do anything to resolve the issue.  I don't see any reference to symbolObj in the map layers (looks like it just holds a symbol name and/or index) nor anywhere else that stands out as a logical place to look, so I don't see anything else to dispose.  Does anyone have any idea of where I could look for any symbolObjs which have been allocated so I can dispose of them so that garbage collection does not choke when attempting to dispose of them for me?  Am I barking up the wrong tree and should be looking somewhere else entirely rather than focusing on symbolObj?

Thanks for any guidance that can be provided,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20121204/0ec19a0f/attachment.htm>


More information about the MapServer-users mailing list