hi! thanks for the reply.. i've done some tests, and decided that (for now) there isnt much benefit from pooling objects (its not like i'm pooling db connections).
i did write a pooling component that took care of being thread safe, limits on how many components could be created etc.. it also required that all pooled objects implement an init/shutdown interface to take care of resetting properties etc. worked well, but in the end the tests showed it wasnt necessary. btw, the tests were just creating/freeing large numbers of objects (10-100mil), seeing if there was any effect on the application (eg gradual decrease in performance etc..) all seemed fine, which was.. reassuring.. :-) thanks, ben. --- Stephen Bertram <[EMAIL PROTECTED]> wrote: > This is an area where I have never found one answer solves all. > > The main thing to watch is memory leaks - we use Sleuth Codewatch and > it has saved us a couple of times. > > With multithreading you have to add critical sections and inuse > flags. If the ojects are shortuse you can envelope the acquire-drop > in one critical section, but normally you have to give the acquire > function the ability to instantiate extra copies if necessary. > > The simplest way I have found is to write the "pooling" into the > object itself by overwriting the Create and Free methods to maintain > an instantiated object in a unit variable. This involves minimal > additional code and means that you can add the additional > functionality at any time without affecting the code in the rest of > the application. It also makes it easier to do side by side tests to > see the result of maintaining a static copy of a particular object. > > Just make sure that the Create method resets all properties to > default and calls any OnCreate events. > > Stephen __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/