What's the status of the review queue?

dsimcha dsimcha at yahoo.com
Thu May 26 05:34:23 PDT 2011


On 5/26/2011 12:31 AM, Andrei Alexandrescu wrote:
> Right now the review queue is empty, and I wonder whether there's some
> new stuff ready in people's pipeline. At some point I recall there were
> even complaints about the review cycle being too slow!
>
> So, please chime in with components that are ready for the review process.
>
>
> Thanks,
>
> Andrei
>

Well, I had put TempAlloc up for review but it didn't seem to actually 
get reviewed.  TempAlloc is a thread-local segmented stack memory 
allocator (defined/detailed in the docs) for efficiently allocating 
temporary buffers, matrices, etc.  It has the following advantages 
compared to allocation on the call stack:

1. Pointers to memory allocated on the TempAlloc stack are still valid 
when the function they were allocated from returns. Functions can be 
written to create and return data structures on the TempAlloc stack.

2. Since it is a segmented stack, large allocations can be performed 
with no danger of stack overflow errors.

It has the following advantages compared to heap allocation:

1. Both allocation and deallocation are extremely fast. Most allocations 
consist of verifying enough space is available, incrementing a pointer 
and a performing a few cheap bookkeeping operations. Most deallocations 
consist decrementing a pointer and performing a few cheap bookkeeping 
operations.

2. The segmented stack is thread-local, so synchronization is only 
needed when a segment needs to be allocated or freed.

3. Fragmentation is not an issue when allocating memory on the TempAlloc 
stack, though it can be an issue when trying to allocate a new segment.

It'd be nice to get this in the next release b/c SciD, which is being 
worked on extensively for GSoC, uses it and Don said he wanted to use it 
in BigInt.

Code:

https://github.com/dsimcha/TempAlloc/blob/master/tempalloc.d

Docs:

http://cis.jhu.edu/~dsimcha/d/phobos/core_tempalloc.html


More information about the Digitalmars-d mailing list