std.allocator needs your help
jerro
a at a.com
Tue Sep 24 15:24:43 PDT 2013
> Also, how does it work with your deallocate interface? Suppose
> I request an 0x100 aligned block of 0x100 bytes. Your alignment
> allocator requests 0x200 from the GC, which maybe returns
> [0xffff0040-0xffff0240] and then returns an aligned buffer from
> that [0xffff0100-0xffff0200]. Later, I try to deallocate that
> buffer, which means your alignment allocator has to deallocate
> the original buffer. Where does the alignment allocator store
> the original GC-provided buffer ptr + size? It cannot be
> determined from the buffer I gave it.
It can store it just before the address it returns. I have an
example
of this at
https://github.com/jerro/pfft/blob/multidim/pfft/clib.d#L46 .
If the deallocate method takes the size of the returned block as a
parameter in addition to the pointer, the original pointer could
also be stored right after the end of the returned block.
More information about the Digitalmars-d
mailing list