[mapguide-users] Memory Leak in Java

Jackie Ng jumpinjackie at gmail.com
Thu Dec 19 17:59:48 PST 2019


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


More information about the mapguide-users mailing list