Java: difference between strong/soft/weak/phantom reference

Java provides two different types/classes of Reference Objects: strong and weak. Weak Reference Objects can be further divided into soft and phantom. Strong Weak soft phantom Let’s go point by point. Strong Reference Object StringBuilder builder = new StringBuilder(); This is the default type/class of Reference Object, if not differently specified: builder is a strong … Read more

How do I declare an array of weak references in Swift?

Create a generic wrapper as: class Weak<T: AnyObject> { weak var value : T? init (value: T) { self.value = value } } Add instances of this class to your array. class Stuff {} var weakly : [Weak<Stuff>] = [Weak(value: Stuff()), Weak(value: Stuff())] When defining Weak you can use either struct or class. Also, to … Read more

What is the difference between a weak reference and an unowned reference?

Both weak and unowned references do not create a strong hold on the referred object (a.k.a. they don’t increase the retain count in order to prevent ARC from deallocating the referred object). But why two keywords? This distinction has to do with the fact that Optional types are built-in the Swift language. Long story short … Read more

What’s the difference between SoftReference and WeakReference in Java?

From Understanding Weak References, by Ethan Nicholas: Weak references A weak reference, simply put, is a reference that isn’t strong enough to force an object to remain in memory. Weak references allow you to leverage the garbage collector’s ability to determine reachability for you, so you don’t have to do it yourself. You create a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)