How does Java Garbage Collection work with Circular References?

Java’s GC considers objects “garbage” if they aren’t reachable through a chain starting at a garbage collection root, so these objects will be collected. Even though objects may point to each other to form a cycle, they’re still garbage if they’re cut off from the root. See the section on unreachable objects in Appendix A: … Read more

How to handle :java.util.concurrent.TimeoutException: android.os.BinderProxy.finalize() timed out after 10 seconds errors?

Full disclosure – I’m the author of the previously mentioned talk in TLV DroidCon. I had a chance to examine this issue across many Android applications, and discuss it with other developers who encountered it – and we all got to the same point: this issue cannot be avoided, only minimized. I took a closer … Read more

Understanding garbage collection in .NET

You are being tripped up here and drawing very wrong conclusions because you are using a debugger. You’ll need to run your code the way it runs on your user’s machine. Switch to the Release build first with Build + Configuration manager, change the “Active solution configuration” combo in the upper left corner to “Release”. … Read more

Do event handlers stop garbage collection from occurring?

For the specific question “Will pClass be garbage collected”: the event subscription has no effect on the collection of pClass (as the publisher). For GC in general (in particular, the target): it depends whether MyFunction is static or instance-based. A delegate (such as an event subscription) to an instance method includes a reference to the … Read more

How does the new automatic reference counting mechanism work?

Every new developer who comes to Objective-C has to learn the rigid rules of when to retain, release, and autorelease objects. These rules even specify naming conventions that imply the retain count of objects returned from methods. Memory management in Objective-C becomes second nature once you take these rules to heart and apply them consistently, … Read more

What is JavaScript garbage collection?

Eric Lippert wrote a detailed blog post about this subject a while back (additionally comparing it to VBScript). More accurately, he wrote about JScript, which is Microsoft’s own implementation of ECMAScript, although very similar to JavaScript. I would imagine that you can assume the vast majority of behaviour would be the same for the JavaScript … Read more