Should ConditionalWeakTable be used for non-compiler purposes?

I don’t see anything wrong with using ConditionalWeakTable. If you need ephemerons, you pretty much have no other choice. I don’t think future .NET versions will be a problem – even if only compilers would use this class, Microsoft still couldn’t change it without breaking compatibility with existing binaries. As for overhead – there certainly … Read more

JVM G1GC’s mixed gc not collecting much old regions

well, you didnt mentioned all arguments you set, but you could try to set -XX:+ScavengeBeforeFullGC and you should also think about your Objects lifecycle. how long do your applications Objects live and what size are the Objects. think about it and take a look at the following arguments -XX:NewRatio=n old/new ration (default 2) -XX:SurvivorRatio=n eden/survivor … Read more

IBOutlet and viewDidUnload under ARC

Just doing a bit of research… As I understand it, weak is similar to assign, in that they’re both weak references. However, assign does not create a zeroing reference. i.e. if the object in question is destroyed, and you access that property, you WILL get a BAD_ACCESS_EXCEPTION. Weak properties are automatically zeroed (= nil) when … Read more

Android Asyntask: Use weak reference for context to avoid device rotate screen

Somewhere in your AsyncTask you’ll want to pass in your activity. Then you’ll save that reference in a weak reference. Then you can dereference and use it again in onPostExecute. Class member: WeakReference<Activity> weakActivity; Somewhere in AsyncTask, probably either constructor or onPreExecute: weakActivity = new WeakReference<Activity>(activity); In onPostExecute: Activity activity = weakActivity.get(); if (activity != … Read more