Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!SUN.COM!gregm From: gregm@SUN.COM (Greg McLaughlin) Newsgroups: comp.windows.news Subject: Re: Idea for reducing memory usage in NeWS Message-ID: <8905311708.AA04203@dublin.sun.com> Date: 31 May 89 23:13:07 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 38 > One important innovation in X/NeWS is the "soft reference". Such a > reference works fine as long as the object continues to exist. When > the last "hard reference" to the object disappears, so does the object, > and an event is sent out to all interested processes. They are > supposed to find their soft reference(s) to that object and remove them. > This not quite true (or at least miss leading). When the last soft reference to an object goes away the object does *not* disappear. Soft references keep the object from going obsolete just as well as hard references. In fact, as long as there are soft references, there are also hard references around. The way it works is that once there are an equal number of hard and soft references (they will come from the same place...think of soft ref's as an anotation to the hard ref that "I want to know when no one is holding any ref's that are not soft") an event will be generated. It is then the responsibility of the processes interested in that obsolete event to clean up their references. Only when *all* the references to the object are gone does the object get GC'ed. Ref possibilities for an object: 0 hard 0 soft => object gets GC'ed hard == soft => /Obsolete event is sent hard > soft => nothing happens, object exists Not a possibility: hard < soft => this just can't happen (unless there is a bug in X/NeWS) I realize that this is not an important distinction in John's mail, but it has been a great source of confusion within Sun. I just want to make sure that NeWS_makers gets it straight. Greg