This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: default allocator, overriding @ runtime


Benjamin wrote:
 >>The question I have is, is it possible to override/replace the default
 >>allocator with my_favorite_allocator at runtime?
 >
 >No. Although it seems like a fun thing to do, I (and others) cannot seem
 >to find a way to do this an still have inter-operability.

A related question:

Some people want to use a different allocator (by default) for all of
stl.  I'd still like to be able to turn it off at runtime.

Is the best/only way to replace the default allocator to muck with 

    libstdc++-v3/include/bits/stl_alloc.h

And just change the code?
Then the run-time disabling would still work (provided we didn't mess
up the code:

,----------------
| 	    if (getenv("GLIBCPP_FORCE_NEW"))
| 	      __atomic_add(&_S_force_new, 1);
| 	    else
| 	      __atomic_add(&_S_force_new, -1);
`----------------



TJ

-- 
Trey Jackson
tjackson@ichips.intel.com

"The wide world is all about you:
 you can fence [yourself] in,
 but you cannot for ever fence it out."
-- Gildor, "Lord of the Rings"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]