The cure for object loitering in this case is to null out the reference after popping it from the stack, as shown in the commented-out line of code in Listing 3.
修复这种情况下的对象游离的方法是,当对象从堆栈弹出之后,就消除它的引用,如清单3中注释掉的行所示。
Therefore, if the collector runs before line //2 attaches a strong reference to the re-created object, the object is lost and wr.get() returns null.
因此,如果收集器在行 //2在重新创建的对象上施加一个强引用之前运行,对象就会丢失,wr.get()则返回null 。
Clear: Setting the reference object's referent field to null and declaring the object in the heap that the reference class referred to as finalizable.
清除:将引用对象的referent域设置为 null ,并将引用类在堆中引用的对象声明为 可结束的。
What you get in your arguments are a reference to the "this" object (this is for object methods and is NULL for plain old functions like bar ) and an argument tuple in args.
您从参数中得到的是一个对“this”对象的引用(this用于对象方法,对类似bar这样的无参数的老式函数来说是NULL)和一个存储在args中的参数元组。
To take advantage of these reference classes, you must break the strong reference to the MyObject object by setting obj to null.
要利用这些引用类,您必须取消对MyObject对象的强引用,方法是将ob j设置为null。
A weak reference object will keep a reference to an object that went out of scope or was set to null, until it is actually deleted by the garbage collector.
一个弱引用对象将会保持一个指向一个超出作用域或者被置空的对象的引用,直到它确实被垃圾回收删除。
Or a reference type variable might not hold a reference to any object, in which case it is said to be a null reference or a reference to Nothing.
或者,引用类型变量可能不存放对任何对象的引用,这种情况称为空引用。
If a pointer pointing to an object not in the graph, then the object is not a reachable object, and then garbage collector sets the slot to null in the short weak reference table.
如果一个指针指向一个不在图中的对象,那么此对象就是一个不可到达的对象,垃圾收集器就将短弱引用表相应的槽置空。
If a pointer pointing to an object not in the graph, then the object is not a reachable object, and then garbage collector sets the slot to null in the long weak reference table.
如果一个指针指向一个不在图中的对象(注意此时图中已包含Finalize可到达的对象),那么此对象就是一个不可到达的对象,垃圾收集器就将长弱引用表相应的槽置空。
If a pointer pointing to an object not in the graph, then the object is not a reachable object, and then garbage collector sets the slot to null in the long weak reference table.
如果一个指针指向一个不在图中的对象(注意此时图中已包含Finalize可到达的对象),那么此对象就是一个不可到达的对象,垃圾收集器就将长弱引用表相应的槽置空。
应用推荐