[mapserver-users] VRT memory usage (from C# Mapscript)

2010-09-02 Thread Lisa Gaudette

I have an application using C# Mapscript where I've got a large number of
.png tiles that wind up representing the same area but under different
conditions. In order to avoid having huge numbers of duplicate .wld files,
I'm using .vrt files to index the tiles.

However, I've realized that each time a request is made for a different map,
my memory usage increases. I can duplicate that with the following code,
where the mapfiles contain .vrt layers but it's fine with a .shp tileindex.
This happens even when the 2nd map represents a much smaller area with many
fewer tiles than the first.

public byte[] Draw(int index)
{
if(index = mapFiles.Length)
throw new ArgumentException(Index out of range);
byte[] bytes;
using (mapObj map = new mapObj(mapFiles[index]))
{
using (imageObj img = map.draw())
{
bytes = img.getBytes();
}
}
return bytes;
}

 I would really rather not have to switch back to using a .shp tileindex and
create thousands of duplicate files, so I'm wondering if anyone has any
ideas on how to make the .vrt layers play nice with memory usage? Or some
entirely different approach?

As a further note, which might be relevant if anyone's got a different
solution, each .vrt file doesn't represent a distinct set of tiles - from
one scenario to the next, many of the tiles remain the same. I.E. the set of
tiles for Scenario A and Scenario B have many, but not all tiles in common.
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/VRT-memory-usage-from-C-Mapscript-tp5491654p5491654.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] VRT memory usage (from C# Mapscript)

2010-09-02 Thread Frank Warmerdam

Lisa Gaudette wrote:

I have an application using C# Mapscript where I've got a large number of
.png tiles that wind up representing the same area but under different
conditions. In order to avoid having huge numbers of duplicate .wld files,
I'm using .vrt files to index the tiles.

However, I've realized that each time a request is made for a different map,
my memory usage increases. I can duplicate that with the following code,
where the mapfiles contain .vrt layers but it's fine with a .shp tileindex.
This happens even when the 2nd map represents a much smaller area with many
fewer tiles than the first.


Lisa,

In recent versions of MapServer an effort is made to keep GDAL files open
between render requests for raster layers with a single file as opposed
to a tile index.  I wonder if you might be running into a problem with
this behavior in a long running mapscript script.  I don't understand
the whole context in which you are operating so I could be off base.  But
you might consider adding:

  PROCESSING CLOSE_CONNECTION=NORMAL

to your raster layer to force the files to be closed at the end of a render.

Best regards,
--
---+--
I set the clouds in motion - turn up   | Frank Warmerdam, warmer...@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush| Geospatial Programmer for Rent

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users