(or better yet, destroy it and return its memory to your memory pool to save an allocation for the next connection object)?
 
An even better suggestion.
Yes, really it's the best suggestion.  And all the IOCP objects (for the actual IOCP read/write, not the "connection" object) should be kept in a pool, etc...  Get really carried away with this.  I wrote a CPool class that keeps track of objects.  When an app shuts down it asks each pool how many objects it had to allocate and stores the values in the registry.  When the app starts back up it tells each pool to go ahead and allocate their appropriate amounts.  This way the amount of memory the biggest load the system was ever under has been "saved" and can be restored.  This time when the same load is encountered the app doesn't waste the time to allocate the memory, it's already ready to go.
 
/dev

Reply via email to