From: Shai <sha...@ya...> - 2011-10-17 16:08:10
|
Hi Guys, I've been banging my head against this memory leak issue for the past couple of weeks trying to resolve it and hopefully you guys can help me understand it. My code which is mostly native iPhone code, uses two threads: main and logical. I have quite allot of native objects allocated (large image objects) but I clear them all up in the finalizer code on the java side (the java object has a "pointer" and when the finalizer is invoked a native method cleans up the pointer). However, it seems the finalizers are only invoked occasionally. This effectively causes all the RAM to run out practically immediately and for some reason xcode's Instruments seems to be completely useless against this particular leak. Debugging the GC it seems to be working as expected and never increases above 3mb total heap (which makes sense for the app) but the free mem eats up the 128mb pretty quickly. Looking at FinalizerNotifier.java I see that the code uses a finalizerMutex which disables the GC, however since I have a separate thread which keeps allocating data and doesn't synchronize against this mutex won't that pose a problem? Thanks. Shai. |