[mapguide-users] Memory Leak in Java

Riccardo Pucci riccardo.pucci at geowebitalia.it
Fri Dec 20 08:35:00 PST 2019


Hi Jackie
thanks for the hints!Calling .delete() changes nothing, it was the first
thing I tried to do...
MgByteSource (MgByteSync) instead, works well! For the moment I'll go with
temporary files.I'll try to make some other test with GetResourceContent to
understand if the leak is related to the reader or only to GetResourceData

Riccardo


Il giorno ven 20 dic 2019 alle ore 02:59 Jackie Ng <jumpinjackie at gmail.com>
ha scritto:

> Still haven't ran your test code, but I have looked at it at a glance and
> throwing out some ideas to try and pre-emptively solve your problem.
>
>  1. This may not actually be a memory leak in the classical definition but
> rather a case of memory being allocated faster than the Java GC can clean
> up. All Java proxy classes have a delete() method that tears down the
> underlying associated C++ pointer and frees any associated memory. This
> method is generally called as part of GC finalization. Perhaps try calling
> delete() on your MgByteSource/MgByteReader manually after using them to
> force the matter perhaps?
>
>  2. Do you need/have to pass file byte buffers around? MgByteSource
> constructor can also take a file path, so there's the option of using temp
> files, which would avoid needing to manage byte buffers and marshaling them
> between Java <-> C++ and avoid allocating memory on the C++ side to handle
> the marshaled bytes.
>
> - Jackie
>
>
>
> --
> Sent from:
> http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapguide-users



-- 
Riccardo Pucci
Geoweb Italia S.r.l.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20191220/cbe5a176/attachment.html>


More information about the mapguide-users mailing list