Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#2255 closed defect (fixed)

C#(MapServer 5.0 Beta3) - Exceptions caused by imageObj.write() and imageObj.getBytes()

Reported by: Zhonghai Owned by: tamas
Priority: high Milestone: 5.0 release
Component: MapScript-C# Version: 5.0
Severity: normal Keywords: VS2005
Cc:

Description

Hi there,

I've compiled MapServer 5.0 Beta3 myself with VS2005, things are working very well, including the AGG rendering. Unfortunatelly, when I save an image into a memory stream with functions imageObj.write() or imageObj.getBytes() , I get exception messages like:

System.OutOfMemoryException was caught
  Message="An Exception of type System.OutOfMemoryException was caught."
  Source="mapscript_csharp"
  StackTrace:
       by OSGeo.MapServer.imageObj.CreateByteArray(IntPtr data, Int32 size)
       by OSGeo.MapServer.mapscriptPINVOKE.imageObj_getBytes(HandleRef jarg1, SWIGByteArrayDelegate jarg2)
       by OSGeo.MapServer.imageObj.getBytes(SWIGByteArrayDelegate callback)
       by OSGeo.MapServer.imageObj.getBytes()
       by ClsMapping.drawMap(mapObj map) in ClsMapping.vb:line 434.

and the source code causes the problem above is:

Dim img As imageObj = Nothing
img = map.draw()
Dim memoryMap As MemoryStream = Nothing
memoryMap = New MemoryStream(img.getBytes())

Seems that there is something wrong.

Change History (9)

comment:1 by tamas, 17 years ago

Does this problem exist only with AGG renderer or with GD as well?

in reply to:  1 comment:2 by Zhonghai, 17 years ago

Replying to tamas:

Does this problem exist only with AGG renderer or with GD as well?

Yes, I've tested it again, it occurs only with AGG renderer.

comment:3 by tamas, 17 years ago

I've tested with GD and AGG and haven't experience such problem on WIN32 and WIN64. However I've built AGG as a static library not a dll.

Would you describe how did you compile agg and submit your test mapfile and data if any?

in reply to:  3 ; comment:4 by Zhonghai, 17 years ago

Replying to tamas:

I've tested with GD and AGG and haven't experience such problem on WIN32 and WIN64. However I've built AGG as a static library not a dll.

Would you describe how did you compile agg and submit your test mapfile and data if any?


Hi there,

this time I compiled MapServer with the beta4, it still has the same problem. I've made a test Windows application here for you. Please download the test application here:

http://www.megaupload.com/?d=9ZEYIYH6

the file contains:

  1. A Test Windows Application with the C# Wrapper that i compiled with VS2005;
  2. The compiled MapServer binary with MapServer-5.0.0-beta4;
  3. The AGG source code version I am using and how I compiled it -- agg-2.4;
  4. The nmake.opt and makefile.vc used for MapServer compilation.

If you need any further inforamtion, please let me know.

Best Regards

Zhonghai

in reply to:  4 comment:5 by tamas, 17 years ago

It seems that the latest version (beta5) is working well. Would you make a test with that?

I've prepared the necessary binaries here:

http://vbkto.dyndns.org:1080/mapserver/szekerest-vc80-quick/package/bin.zip

Note: the assembly has a strong name signature so it should be re-registered in your application during the upgrade.

Tamas

comment:6 by tamas, 17 years ago

This ticket depends on #2241

in reply to:  6 comment:7 by Zhonghai, 17 years ago

Replying to tamas:

This ticket depends on #2241

Hi Tamas,

yes, with Beta5 it works greate. Thanks for your efforts to make it run.

Best Regards

Zhonghai

comment:8 by tamas, 17 years ago

Resolution: fixed
Status: newclosed

Cool. Closing the ticket then.

comment:9 by tamas, 17 years ago

Milestone: 5.0 release
Note: See TracTickets for help on using tickets.