std.allocator needs your help

Jacob Carlborg doob at me.com
Mon Sep 23 11:56:33 PDT 2013


On 2013-09-23 16:05, Manu wrote:

> Another situation that I've encountered on a few occasions...
> Imagine I declare a particular allocator for my application, when
> dealing with 3rd party libs, I expect it to allocate within my
> application's heap. Seems like a situation where I might set a global
> allocator...
> Mr 3rd party library also has its own allocators though, things like
> pools or groups which it uses explicitly within it's code.
> I don't actually want to override these allocators, since they're
> effectively a higher-level construct, but I *do* want to override these
> allocator's memory source. Ie, they should allocate their pools from my
> application's heap, rather than the default heap.
> So in this way, it's important to be able to set overrides at multiple
> levels.

You might be able to combine two different allocators. Basically create 
a new allocator that somehow extends the third party allocator but 
allocates in your own heap instead.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list