Class size and performance
Sean Kelly
sean at f4.ca
Mon Jan 21 00:28:35 PST 2008
Unknown W. Brackets wrote:
> That's a good trick, but it's probably not helpful in this case. My
> problem is, I know that I'm going to have 1000 of these objects. There's
> no reason to allocate each one individually. Rather I should create a
> pool for them, and shove the instances into the pool.
In Tango, use GC.sizeOf to tell you the size of the block reserved for
the pointer in question, and GC.reserve to pre-allocate a chunk of
memory if you have an idea of the high-water mark if your app.
GC.reserve is a relatively new addition and can speed up an app
tremendously in some cases.
Sean
More information about the Digitalmars-d-learn
mailing list