--- In [email protected], Andries Bos <[EMAIL PROTECTED]> wrote: > > Looking for places where I could find borland's advice, I could not find any. However I did find a lot of advices where they just suggest freeandnil(form1). > > to complete your explaination, do you have any url to where this suggestion could be found on the borland site? > > It's not that I do not aggree, but I myself also used freeandnil(form1) untill now. > > thanks > > andries
Well, one place to find this is in the Delphi help files. Just search for the 'Release' command for TCustomForm and you will read this: <quote>Use Release to destroy the form and free its associated memory. Release does not destroy the form until all event handlers of the form and event handlers of components on the form have finished executing. Release also guarantees that all messages in the form's event queue are processed before the form is released. Any event handlers for the form or its children should use Release instead of Free (Delphi) or delete (C++). Failing to do so can cause a memory access error. Note: Release returns immediately to the caller. It does not wait for the form to be freed before returning.</quote> There are probably a few sites online that advise the same which you can find with Google: http://www.google.com/search?q=TForm.Release The main problem with the 'Free' method is that it immediately destroys the form, even if there are still a few messages that it will need to handle. It will often work out just fine and once in a while you'll get an unexplainable bug. A real annoying one too because you don't always realise that it's related to freeing the form instead of releasing it. What release actually does is this: PostMessage(Handle, CM_RELEASE, 0, 0); In other words, it sends a message to the messageloop and when the form starts processing this message, it will free the form. Thus any messages that have been sent prior to this message will be processed. With kind regards, X Katja Bergman. ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/i7folB/TM --------------------------------------------------------------------~-> ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

