[ace-users] Ace and Memory [NC]

graham.walsh at sgcib.com graham.walsh at sgcib.com
Mon Sep 10 02:18:02 CDT 2007


ACE version 5.6,

OS Windows XP Professional.

Compiler:   Borland C++ Builder version 6


Hi,

I'm using the ACE allocators in the hope of improving performance. The goal
is to reduce the time we spend doing heap allocations. We have no issues
with the size of our process or how much memory it consumes (broadly
speaking) but we definitely need to enhance performance via allocators.
We've already deploy boost allocators/memory pooling in other parts of the
application (the visual studio side), but we cannot use boost for our
borland c++ builder dlls/side (the app contains both dlls side by side) as
boost doesn't support c++ builder 6


In any case, I'm trying to use the ACE allocators to do some memory
pooling.

To this effect I started researching and testing the
ACE_Dynamic_Cached_Allocator which works fine.. except for one aspect.

The allocator uses;

ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<char>, ACE_LOCK> free_list_;



when I create an instance of the allocator defined thus;

typedef ACE_Dynamic_Cached_Allocator<ACE_SYNCH_MUTEX> Allocator;


static Allocator allocator_(sizeof(Toto2), 100 );  // toto is my class
which needs to be sped up

it seems that after 100 chunks have been allocated, it does not allocate
any more. I need more memory to be allocated so subsequent calls to malloc
from my version of new will be satisfied after 100 chunks are returned.


void* Toto2::operator new (size_t size)
{
      return allocator_.malloc(size);
};

Looking at my test program, i can verify that after 100 allocations (calls
to _malloc on the allocator), no more memory is allocated/added to the
pool.

Could anybody help me out? I have this stuff working with boost but as I
say, I can't use boost for my borland c++ builder 6 dll (they don't support
cbuilder 6)



thanks much and have a nice day

G
*************************************************************************
This message and any attachments (the "message") are confidential and intended solely for the addressee(s).
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or
falsified.
                              ************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses
destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. 
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie.
*************************************************************************



More information about the Ace-users mailing list