From: Wolfgang K. <wol...@xm...> - 2009-10-11 06:55:01
|
We have the NoAutoReleasePool annotation which inhibits the creation of an autorelease pool. We use that to prevent anonymous inner classes from being released right after creation when a method returns. This problem occurred for event handler which should clearly live longer than just for the method where they were created. So this is not really an optimization. We also do not have something like an explicit release since there is nothing like this in Java or the Android API. To avoid memory leaks due to circular dependencies you have to first break the cycle by manually by deleting on of the references forming the cycle so that it is no longer cyclic. After that you can "forget" the reference to the cycle and the objects will be cleaned up. -- Wolfgang Panayotis Katsaloulis wrote: > On 10 Οκτ 2009, at 11:54 μ.μ., Wolfgang Korn wrote: > > >> We make use of reference counting and the autorelease pool mechanism >> offered by Cocoa. Since reference counting is not as powerful as a >> full-fledged garbage collector there is a limitation with this >> approach: >> Using reference counting does not clean up unreferenced circular data >> structures, what a garbage collector of course would do. So you have >> to >> be a little bit careful to avoid this - otherwise the cross compiled >> application would have a memory leak. >> > > I've seen here > http://www.cokeandcode.com/XMLVM-OpenGL-Support-Patch-Commited > which talks about annotations. > > I looked at the source code and I saw this, in file > XMLVMNoAutoReleasePool.java > @Retention(RetentionPolicy.CLASS) > so, is there any way to "optimize" GC with annotations? > > And, one more thing, is there a way to force send an object to > oblivion, e.g. when we have cycle dependencies like the one mentioned > above (and I just want to free some memory) ? > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > xmlvm-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-users > |