<div dir="ltr">Hi Benoit<br>Your hint is helpful: I tried with a smaller buffer (1024) and the leak is greatly reduced so the dimension of buffer is somehow involved. Still the leak remain. There is some memory allocated by c++ that is not freed. That memory is off of the java heap, so it cannot be directly managed by garbage collection.<br>Riccardo <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mer 18 dic 2019 alle ore 21:50 Benoit Begin <<a href="mailto:bbegin@geomapgis.ca">bbegin@geomapgis.ca</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'm no Java expert, but I feel it could be a similar issue that you may face<br>
with .NET and Large Heap Objects. With the size of the byte array you are<br>
creating, 1024x1024, you might be overruning the size of the level 1<br>
generation for the Garbage Collector and end up putting your data in a later<br>
generation that doesn't get collected very often.<br>
<br>
So when I do things in .NET with MgReaders that can get sizeable, I do set a<br>
hard cap at 4096 bytes being read per iterations and they don't end up on<br>
the LOH. Looking at your code, you potentially create 4 1MB large objects<br>
every round. So those likely end up somewhere in your memory stack that the<br>
JVM garbage collector doesn't clean up very quickly.<br>
<br>
I did some quick Google searches about it and it seems a fairly common topic<br>
when it comes to Java and object generation. I think it might be worth it to<br>
do a quick search to optimize on that front.<br>
<br>
Hopefully someone more knowledgeable about Java can chime in, but I feel it<br>
might be a worthwhile area to look into while waiting for a reply!<br>
<br>
Regards,<br>
<br>
Benoit<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html</a><br>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapguide-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapguide-users</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><font face="courier new, monospace">Riccardo Pucci</font></div><div><span style="color:rgb(0,0,0);background-color:rgb(245,245,245)"><font face="courier new, monospace">Geoweb Italia S.r.l.</font></span><br></div></div></div>