pinning revisited
Jason O'Brien
xergen at hotmail.com
Tue Jul 25 10:25:03 PDT 2006
Sean Kelly wrote:
> The Ares GC interface is a tad different from Phobos, and contains
> pin/unpin methods. Here's a webpage describing it:
>
> http://svn.dsource.org/projects/ares/trunk/doc/ares/std/memory.html
I'm glad to see ares has them :) However, from what I could tell it will
be a while before Ares replaces phobos :( Adding the dummy functions
would be very helpful. (I'd also like to see the pin keyword in the
language, for reasons almost eerily similiar to the GC vs manual memory
debate. It would avoid memory leaks for the common case, which is per
function pinning. Also obviously doesn't have any overhead over the
manual alternative :))
I'd also think a copying collector probably shouldn't collect pinned
objects, so for compatability this one shouldnt either (by scanning pin
list for roots). Would make language interop and ownership transfer more
intuitive (if you temporarily don't want it to move, you probably don't
want it to be collected in the meantime either).
Could do that yourself of course with addRoot, should work in either
case, I just think it's less intuitive. Obviously the overhead of this
could be avoided if the compiler was pin-aware (you don't need to root C
function params for example). Not sure whether it'd hurt performance of
a noncopying gc, but a copying one could simply search the pin list for
roots.
More information about the Digitalmars-d
mailing list