new & delete in CRT.How to get a efficitive memory allocator.

M

madmanahong

I Found new & delete of the CRT was very slow.

so I overloaded the global new & delete operator.

but if the CRT & STL also use my new & delete operator.

It's bad because then my overloaded memory system didn't initialized.

I also find the DLMalloc, but use 20 threads to call DLMalloc in a
time, its wrong.
DLMalloc called abort.( I Opened the USE_LOCKS macro ).

sorry, i didn't make the operator new & delete in class-level.
because the project have a lot of classes,
I have no time to inherit from class-level operator one by one.

I want to use a fast memory operator than CRT default.
I cound initialize my overloaded memory system on first call, use
singleton model.
but i don't know if i do this was right or wrong.

who give me some experience.
Hope your help.
at sea....
 
A

Axter

I Found new & delete of the CRT was very slow.

so I overloaded the global new & delete operator.

but if the CRT & STL also use my new & delete operator.

It's bad because then my overloaded memory system didn't initialized.

I also find the DLMalloc, but use 20 threads to call DLMalloc in a
time, its wrong.
DLMalloc called abort.( I Opened the USE_LOCKS macro ).

sorry, i didn't make the operator new & delete in class-level.
because the project have a lot of classes,
I have no time to inherit from class-level operator one by one.

I want to use a fast memory operator than CRT default.
I cound initialize my overloaded memory system on first call, use
singleton model.
but i don't know if i do this was right or wrong.

who give me some experience.

Try using the boost library.
http://www.boost.org/
If you use boost, you can define BOOST_SP_USE_QUICK_ALLOCATOR, which
will give you a more optimized allocator for new.
#define BOOST_SP_USE_QUICK_ALLOCATOR

It doesn't work with VC++ 6.0, but it does work with more compliant
compilers like VC++ 7.1, 8.9 and GNU 3.x
 
M

madmanahong

good.

quick_allocator.hpp

but I think it was not better than stl's allocator or dlmalloc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top