Hello,

I think this reported problem could be related tot he ticket 
https://osgeo-org.atlassian.net/browse/GEOT-6517.

Best Regards
Sören


-----Ursprüngliche Nachricht-----
Von: Jody Garnett <jody.garn...@gmail.com> 
Gesendet: Freitag, 21. April 2023 20:58
An: gero.will...@gmx.net
Cc: geotools-de...@lists.sourceforge.net; 
geotools-gt2-users@lists.sourceforge.net
Betreff: Re: [Geotools-gt2-users] Memory Leak in Streaming Parser

The EMF / XSD parsing stuff does have some caches; but no I am not aware why 
this is happening for you.
Can you use your IDE profiler or heap management tools to determine what 
objects are leaking?


You should be able to call parse multiple times if you are reading from the 
same input stream...
--
Jody Garnett


On Fri, Apr 21, 2023 at 4:47 AM gero.will...@gmx.net 
<mailto:gero.will...@gmx.net>  <gero.will...@gmx.net 
<mailto:gero.will...@gmx.net> > wrote:


                        Hello togehter,
                        
                        my usecase is using method StreamingParser.parse()  in 
a loop in my java application (ca. 5000 iterations). Unfortunately this leads 
to a huge memory leak. Also this memory can never be released by the garbage 
collector. It stays in the old gen heap forever.
                        
                        I use
                        
                        
https://github.com/geotools/geotools/blob/main/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xsd/StreamingParser.java
 
<https://ofcsg2dvf1.dwd.de/fmlurlsvc/?fewReq=:B:JVg8NzM3PCBwOzQoNiBvYjs2Nzw2NyB1b2FoZ3JzdGM7PmdjPzIwMWQ1ZDVlNzFjYzdlYzVlMWU0NT4yMDI2MWI+ZT42PmdiPyByOzcwPjQ3NjUwNzcgd29iOzU1Skw2RFdHNjcxMTM1KzU1Skw2RFdENjcxMTM1IHRldnI7VWljdGNoKE1namN1dWNGYnFiKGJjIGU7MzQgbmJqOzY=&url=https%3a%2f%2fgithub.com%2fgeotools%2fgeotools%2fblob%2fmain%2fmodules%2fextension%2fxsd%2fxsd-core%2fsrc%2fmain%2fjava%2forg%2fgeotools%2fxsd%2fStreamingParser.java>
 
                        
                        
                        in this way:
                        
                        

                        for(.....) {
                            try {
                                    org.geotools.xsd.StreamingParser parser  = 
new org.geotools.xsd.StreamingParser(gml, inputStream, Polygon.class);
                                    polygon = (Polygon) parser.parse();
                            } finally {
                                    inputStream.close();
                            }
                        }

                        
                        
                        Do you have any idea why that happens? Are you even 
able to fix it?

                        
                        I use the following maven dependency:
                        
                        

                        <dependency>
                            <groupId>org.geotools.xsd</groupId>
                            <artifactId>gt-xsd-wfs</artifactId>
                            <version>27.2</version>
                        </dependency>

                        
                        

                        
                        Best regards,
                        
                        Gero
                        
                        

        _______________________________________________
        GeoTools-GT2-Users mailing list
        GeoTools-GT2-Users@lists.sourceforge.net 
<mailto:GeoTools-GT2-Users@lists.sourceforge.net> 
        https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users 
<https://ofcsg2dvf1.dwd.de/fmlurlsvc/?fewReq=:B:JVg8NzM3PCBwOzQoNiBvYjs2Nzw2NyB1b2FoZ3JzdGM7ZTYyPmBgMzUzNDFgNGdkPmVnPzZlNjM3MWUyNWQ/PjQ0MGQwZzY2YiByOzcwPjQ3NjUwNzcgd29iOzU1Skw2RFdHNjcxMTM1KzU1Skw2RFdENjcxMTM1IHRldnI7VWljdGNoKE1namN1dWNGYnFiKGJjIGU7MzQgbmJqOzY=&url=https%3a%2f%2flists.sourceforge.net%2flists%2flistinfo%2fgeotools-gt2-users>
 
        


_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to