Greedy memory handling
monarch_dodra
monarchdodra at gmail.com
Thu Sep 12 13:33:56 PDT 2013
On Thursday, 12 September 2013 at 19:13:40 UTC, Dmitry Olshansky
wrote:
> Double indirection? Allocate a class that has finalizer, hold
> that via weak-ref. The wrapper in turn contains a pointer to
> the buffer. The interesting point then is that one may allocate
> said buffer via C's realloc.
>
> Then once helper struct is collected the finalizer is called
> and this is where we call free to cleanup C's heap.
>
> I'm thinking this actually is going to work.
Yum. I like this.
I was going to say: "At the end of the day, if the GC doesn't
*tell* us the collection happened, then the problem is not
solve-able. We'd need a way that would allow the GC to tell us
the memory was *finalized*". And then I'd go on to say "since our
GC is non-finalizing, there is simply no solution".
But then classes. Derp.
I'd be real interested in having a finalized solution. The
"details" of how memory addressing is not my strong suite, so I
wouldn't trust myself with all those union{ptr/size_t} things.
Thanks, I'll start toying around with this :)
More information about the Digitalmars-d-learn
mailing list