TempAlloc

dsimcha dsimcha at yahoo.com
Fri Dec 5 15:20:49 PST 2008


As per a discusson on digitalmars.D about a month ago, I've created a temp
space allocator for quickly allocating memory in a last in, first out manner.
 Its main use is for allocating scratch space to be used within a function
without introducing threading bottlenecks, etc.  I've released it as an alpha
on scrapple.  I'm working on a major update to my statistics library (also on
scrapple) and will dogfood this there when I'm done with the update.  I think
that it's pretty useful, at least in number crunching-type code, in its
current form as a library.  However, it might be even better if integrated
into druntime and the core language to make it safer (it's pretty dangerous if
used incorrectly) or cleaner to use (I've done the best I can here, but if I
had some compiler support, I could automate some stuff that I make the caller do.)

For the code, see
http://dsource.org/projects/scrapple/browser/trunk/tempAlloc.  The code is for
D2 only, but could probably be ported to D1 using Tango's thread-local storage.


More information about the Digitalmars-d-announce mailing list