<div dir="ltr">On 23 September 2013 23:38, Jacob Carlborg <span dir="ltr"><<a href="mailto:doob@me.com" target="_blank">doob@me.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 2013-09-23 11:31, qznc wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
5. Class local - The allocator is used for specific types (e.g. ASTNode<br>
in a compiler)<br>
<br>
6. Class-hierarchy - The allocator is used for a specific type hierarchy<br>
(e.g. ASTNode might have sub classes Statement,BinOp,etc)<br>
<br>
7. Container local - The C++ way which binds allocation to a wrapping<br>
container<br>
<br>
8. Task local - like Thread local but for std.parallelism.Task<br>
<br>
That's it for now.<br>
<br>
This is quite a long list, which means it is probably exhaustive. There<br>
should be a generic approach which encompasses at least those cases.<br>
</blockquote>
<br></div>
That's a good addition to the list.</blockquote><div><br></div><div>Another situation that I've encountered on a few occasions...</div><div>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...</div>
<div>Mr 3rd party library also has its own allocators though, things like pools or groups which it uses explicitly within it's code.</div><div>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.</div>
<div>So in this way, it's important to be able to set overrides at multiple levels.</div></div></div></div>