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

Lisa Gaudette lgaudette at ehealthinformation.ca
Thu Sep 2 11:39:46 EDT 2010


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.


More information about the mapserver-users mailing list