Hi Michael,
I suggest for any reasonable size dataset you use the StreamingParser:
StreamingParser parser =
new StreamingParser(configuration,"//gml:featureMember");
try{
Feature f = null;
while ( ( f = parser.parse() ) != null ) {
...
}
}...
}
Some more info about streaming here:
http://docs.codehaus.org/display/GEOTDOC/GML+XML+Support
-Justin
Michael Lutz wrote:
> We are running into big memory problems when trying to parse large GML
> files containing WFS feature collections (e.g. 25000 points, about 25MB
> as GML) using the following code:
>
> public static FeatureCollection readFromInputStream(InputStream in) {
> Configuration configuration = new WFSConfiguration();
> Parser parser = new Parser(configuration);
> try{
> FeatureCollection fc = (FeatureCollection) parser.parse( in );
> in.close();
> return fc;
> } ...
> }
>
> For this example, the used memory goes up to 800MB. After the parsing,
> it goes down again to around 60MB.
>
> Any ideas why this is, and where we should be looking for memory leaks?
>
> Cheers,
> Michael
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
> !DSPAM:1004,45dc87ae102861460912952!
>
--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel