Question about memory management.



 DEVELOP > c-Plus-Plus > Question about memory management.

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Renji Panicker"
Date: 14 Dec 2007 10:03:26 PM
Object: Question about memory management.
Hi everyone,
When developing a C++ application which requires creation/deletion of
small classes multiple times, can we rely on the memory management in
the standard libraries, or is it smarter to develop our own (perhaps
by overloading new/delete)?
I realize the answer to this question is compiler dependent (I am
using gcc 4.1.3 on Linux). However, can someone provide a general
answer, since the application I have in mind is expected to be cross
platform to work at the least with msvc and XCode as well.
Thanks!
-/renji
.

User: "Lance Diduck"

Title: Re: Question about memory management. 15 Dec 2007 10:22:30 AM
On Dec 14, 11:03 pm, Renji Panicker <renjipanic...@gmail.com> wrote:

Hi everyone,

When developing a C++ application which requires creation/deletion of
small classes multiple times, can we rely on the memory management in
the standard libraries, or is it smarter to develop our own (perhaps
by overloading new/delete)?

I realize the answer to this question is compiler dependent (I am
using gcc 4.1.3 on Linux). However, can someone provide a general
answer, since the application I have in mind is expected to be cross
platform to work at the least with msvc and XCode as well.

Thanks!
-/renj

After profiling does indeed find a bottleneck (and on your system the
worst is creating a small object in one thread and deleting it in
another) then yes create a small object allocator. new /delete
bottlenecks like this are fairly platform independent, other than the
tuning parameters (like pagesize and alignments). These are very easy
to build, and an example is found in Stroustrups C++TPL.
Lance
.

User: "Ian Collins"

Title: Re: Question about memory management. 14 Dec 2007 11:00:47 PM
Renji Panicker wrote:

Hi everyone,

When developing a C++ application which requires creation/deletion of
small classes multiple times, can we rely on the memory management in
the standard libraries, or is it smarter to develop our own (perhaps
by overloading new/delete)?

I realize the answer to this question is compiler dependent (I am
using gcc 4.1.3 on Linux). However, can someone provide a general
answer, since the application I have in mind is expected to be cross
platform to work at the least with msvc and XCode as well.

A custom allocator may help, but the only way to know for sure is to
measure. Object creation and deletion may not even be bottlenecks in
your system
--
Ian Collins.
.
User: "Renji Panicker"

Title: Re: Question about memory management. 14 Dec 2007 11:06:06 PM
Thanks for the quick response, Ian.
Regards,
-/renji
.



  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER