On 20 Oct 2000, at 10:36, Alex Rousskov <rousskov@measurement-factory.com> wrote:
> On Fri, 20 Oct 2000, Andres Kroonmaa wrote:
>
> > you mean put a pointer to next free object in place of first few bytes
> > of free object? Thats nice trick I think.
>
> Just keep in mind that pointers/counters may need to be aligned on some
> platforms. For example, a "struct { char buf[9] }" in an array may not
> be aligned, and using its first bytes for a pointer or offset counter is
> dangerous.
>
> Thus, if you use first bytes of a free object, you probably want to copy
> the pointer into a local variable before de-referencing it. Not a big
> deal, of course.
well, I think we should be safe within pools, as poolCreate is passed
obj size that should be suitably aligned and padded for use in arrays.
But for the safe side, we could forcibly round up obj size to a multiple
of pointer. this should make us safely aligned to sizeof(pointer)
With a list we can't pool smaller objects than sizeof pointer anyway.
------------------------------------
Andres Kroonmaa <andre@online.ee>
Delfi Online
Tel: 6501 731, Fax: 6501 708
Pärnu mnt. 158, Tallinn,
11317 Estonia
Received on Fri Oct 20 2000 - 12:45:30 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:52 MST