Advertisements

wrote:
> Hi,
> Is the standard stl allocator in gcc is bettor (in performance) than
> malloc or is it same as malloc?

The standard allocator is based on new/delete. More precisely, allocate()
uses :perator new(size_t) and deallocate uses :perator delete(void*).

I do not know whether gcc translates new/delete into malloc/free or whether
it uses some other scheme.

> I'm going to implement an object pooling mechanism to reduce the
> number of memory allocations and deallocations performed.
>
> It seems pointless to use stl containers (such as std::list) to
> implement such a mechanism if they start doing memory allocations and
> deallocations for every operation I perform on them

I don't exactly understand what you are aiming for. The usual way is to
implement a pooling allocator (or some other custom allocator that
implements your memory management scheme) and use that allocator for the
containers.

Guest

Thanks everyone for the comments,

On Feb 26, 10:08 am, Kai-Uwe Bux <> wrote:
> I don't exactly understand what you are aiming for. The usual way is to
> implement a pooling allocator (or some other custom allocator that
> implements your memory management scheme) and use that allocator for the
> containers.

We knew that creating destroying objects frequently is very in-
efficient. So we have a template based object pooling mechanism in
some processes and when I look into that code it seems that it was
written based on a std::list. So my concern was is it worthless to
write such a pooling mechanism to reduce memory allocations if we are
inserting and removing list elements for every operation (in which it
is indirectly doing the same thing while doing the list operations)?

Guest

On Feb 26, 5:00 am, wrote:
> Hi,
> Is the standard stl allocator in gcc is bettor (in performance) than
> malloc or is it same as malloc?
>
> I'm going to implement an object pooling mechanism to reduce the
> number of memory allocations and deallocations performed.
>
> It seems pointless to use stl containers (such as std::list) to
> implement such a mechanism if they start doing memory allocations and
> deallocations for every operation I perform on them
>
> TIA,
>
> Tharinda

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!