> Hello all, > > I'm looking for a way to quickly allocate a high number of small > objects on the heap. I have attached a sample program with what I'm > trying to do; when I allocate a vector of objects it's hundreds of > times faster than allocating a vector of pointers and new()'ing every > object. That is to be expected of course, I was just wondering if > there is a way to speed things up (ie, allocate a bunch of memory, and > have the pointers in my vector point to it). I hope I explained myself > clearly; the code will illustrate, I think.
I have an article on implementing a library with just this goal, and the source code to the library comes with the article itself. The library accepts many kinds of customizations which are all covered in the article's text. You can find it at: http://www.beginthread.com/Ehsan/ViewAllArticles HTH, ------------- Ehsan Akhgari Farda Technology (http://www.farda-tech.com/) List Owner: [EMAIL PROTECTED] [ Email: [EMAIL PROTECTED] ] [ WWW: http://www.beginthread.com/Ehsan ] Close your eyes, and imagine to be without what we take for granted every time we open our eyes...
