dlangBugzillaToGithub / migration_test

0 stars 0 forks source link

Add weak references to Phobos/druntime #638

Open dlangBugzillaToGithub opened 14 years ago

dlangBugzillaToGithub commented 14 years ago

nfxjfg reported this on 2010-05-02T20:55:00Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=4151

CC List

Description

Just that.

The Java API documentation may provide a good starting point as to what weak references should be able to do:
http://java.sun.com/javase/7/docs/api/java/lang/ref/WeakReference.html

Note that finalizers and the "hidden" rt_attach.../detach... functions are highly unsafe and hard to get right. As an example what can go wrong if users try to implement their own weak references, see bug 4150.
dlangBugzillaToGithub commented 11 years ago

verylonglogin.reg commented on 2013-03-16T05:06:59Z

Even worse GC lock/unlock aren't parts of a druntime user API so one have to use ugly things like calling addRange/removeRange to ensure the memory will not be collected.
dlangBugzillaToGithub commented 11 years ago

verylonglogin.reg commented on 2013-10-08T02:58:32Z

One can use this implementation for now:
http://denis-sh.bitbucket.org/unstandard/unstd.memory.weakref.html
dlangBugzillaToGithub commented 11 years ago

verylonglogin.reg commented on 2013-10-16T02:58:28Z

A proposal to add library implementation without runtime changes:
http://forum.dlang.org/thread/l3dj7b$2tvc$1@digitalmars.com
dlangBugzillaToGithub commented 6 years ago

dmitry.olsh commented on 2018-05-17T12:27:26Z

Even in Java Weak references solve about as much problems as they introduce. But a library based solution could indeed come in handy.