D on next-gen consoles and for game development
Timon Gehr
timon.gehr at gmx.ch
Sat May 25 16:19:36 PDT 2013
On 05/24/2013 04:33 PM, Manu wrote:
> But anyway, after fixing the obvious Phobos offenders, another huge
> step would be to get TempAlloc into druntime and used wherever
> possible in Phobos.
>
>
> How does that work?
>
> One pattern I've used a lot is, since we have a regular 60hz timeslice
> and fairly a regular pattern from frame to frame, we use a temp heap
> which pushes allocations on the end like a stack, then wipe it clean at
> the state of the next frame.
> Great for any small allocations that last no longer than a single frame.
> It's fast (collection is instant), and it also combats memory
> fragmentation, which is also critically important when working on memory
> limited systems with no virtual memory/page file.
Yes, that is basically it.
https://github.com/dsimcha/TempAlloc/blob/master/std/allocators/region.d
More information about the Digitalmars-d
mailing list