[gdal-dev] Re: GDAL Java Binding meomory problem under intensive method calls

easyl thlin.box at gmail.com
Fri Jan 6 04:45:37 EST 2012


directly using ogr2ogr and ogrinfo from
http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/java/apps/
I made a following test cae.


somehow I noticed that the error occurs when the S57 data more than 1mb

==============================

public class TestViolation {

   public static void main(String[] args) {

      final String src = "test/data/DE416030.000"; // S75 data
      final String tmp = "test/data/tmp";
      {
         final String param[] = { "-ro", "-al", src};
         // I have modified the ogrinfo code so that it returns Layers @see
http://snipt.org/tkppl5
         final List<Layer> layers = ogrinfo.main(param); 
         final Map<String, Layer> layerMap = new Hashtable<String, Layer>();
         for (Layer layer : layers) {         
            layerMap.put(layer.GetName(), layer);
         }

         // do some processing
         for (String layer : layerMap.keySet()) {
            String[] types = {"POLYGON", "POINT", "LINESTRING"}; 
            for (String type : types) {
               String[] command = new String[]{"-skipfailure", "-append",
"-f","ESRI Shapefile", tmp,src, "-nlt", type, layer};
               }
               ogr2ogr.main(command);
            }  
         }
         // do some processing
         
         for (Layer layer : layers) {         
            layer.GetFeatureCount(); // it crashed here!!!!
         }        
      }

   }
}

==============================

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/GDAL-Java-Binding-meomory-problem-under-intensive-method-calls-tp7155011p7157803.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list