Re: [mapguide-users] RenderMap: MgOutOfMemoryException

2020-08-27 Thread Benoit Begin
I can definitely confirm that rendering large map images via the API is
definitely memory intensive on the Mapguide site. Then when you get the
image out into .NET, you might even go into deeper problems with the way the
Large Object Heap collection works and so on. You can end up with pretty
massive amounts of memory in there if your code is running in a service or
something where memory collection can be more harduous.

You could look into creating smaller tiles and stiching them up for the
resulting image. It might keep memory usage under control. Perhaps limiting
the map images to boxes of 2048x2048 and then tiling them back into a single
image. It does require a bit of math and finagling, but definitely worth the
trouble.

There might also be some issues on depending on what kind of app this code
runs. If it's a web app, if 2-3 users end up asking for the same large image
within a similar timespan, it could get crazy. So that's something that
generating smaller tiles might help out with.

Hope the idea helps out!



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

Re: [mapguide-users] RenderMap: MgOutOfMemoryException

2020-08-27 Thread Jackie Ng
I can tell you right now, if you're expecting a 80MB png to be rendered, it
will not take 80MB of memory to render said PNG. It takes much much more
memory.

I did a little test just to see how much memory is being used to render the
Sheboygan sample map at full map extents with an image size of 9922 x 14302
pixels.

~610MB memory is allocated to set up the raw image buffer for the AGG
renderer
Another ~670MB memory is allocated to set up the PNG pixel buffer for
converting the AGG renderer result to PNG.
The resulting PNG image is ~33MB

So at least ~1.24GB of memory is used to produce a 9922 x 14302 PNG image
that is 33MB.

This does not include any extra memory allocations from whatever user code
that is calling this RenderMap API.

This is with the Sheboygan map that only has 10 layers.

Take the numbers outlined here and scale appropriately to your particular
map. Not the most scientific method, but at least it will give you a rough
number in terms of memory usage.

Are you on 64-bit MapGuide at least? If so, how much physical RAM does that
machine have? You probably need to throw more RAM at it if you're going to
be plotting images of this size on a regular basis.

If it's 32-bit MapGuide, forget it. Windows only allows a 32-bit process to
address 2GB of memory (ref:
https://stackoverflow.com/questions/639540/how-much-memory-can-a-32-bit-process-access-on-a-64-bit-operating-system)

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users