Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

array of objects ?

array objects
0
Posted

array of objects ?

0

> >>Call each objects destructor and then a dealloc for the whole array ?[/color] > > > > > > That’s right.[/color] > > But this is a hassle for me, since I then have to rember the size of > each array (the number of elements in there) or otherwise i would not be > able to delete it correctly. > > Looks like this will just increase my overhead and not give me any > significant speedups. > > My problem is, i’m doing billions (!) of new and delete (and copy ctors) > on small int arrays, which results in quie slow code.[/color] Perhaps you should have a look at the small object allocator that is part of the Loki library. I did some tests on it myself and found a significant speed up compared to the allocator that comes with my compiler. http://sourceforge.net/projects/loki-lib/ Also described in the book ‘Modern C++ Design’ by Andrei Alexandrescu. Well worth having. [color=blue] >[color=green][color=darkred] > >>Isn’t there a way to simply call some delete[] (mypool) my_array ?[/color] >

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123