We help IT Professionals succeed at work.

General "Component Already Exists" Question

alexiat asked
Medium Priority
Last Modified: 2012-08-13
We have a customer who is using an app written in Delphi5.  Although I don't know exact numbers,
it is a very large app that is RAM intensive.  We have thousands of users with this app and none
have had this problem but this one user.  She says she is using XP with 1000 KB RAM.

The user says she is getting an error message of "A component named MyEditDlg already exists" from
the app.  It can happen after the first "edit" or go for days with no problems at all.  This
component is called from several places, but she is only calling it from one specific location.
The component is called via:

  Execute   //where "Execute := ShowModal=mrOk"

The user claims that if she closes the app and restarts it the error message still occurs.  She
also claims that if she reboots the computer it may or may not still occur.

I am hoping with your expertise you can give me some direction on how this can be happening.

I understand from research the error message is from the component not being released before it
is called again.  I just don't see how this can be from the above code, nor can I understand how
rebooting wouldn't get rid of the problem.  Is there a difference between completely shutting
down the computer and doing a restart versus a reboot.  Is there any way this error could occur from
insufficient memory on her computer?

I realize this is quite a general question but I am hoping someone can give me some insight on
this problem (so I can get some sleep!)

As always, Thanks.
Watch Question

I have noticed that there can be occasional problems like this where for some reason a created and called form does not get freed properly and it was in Delphi 5. Whats more the problem only occurred if you did something in a particular order.

I never found a complete answer to the question, I ended up ensuring that minimal number of forms were created at start up and to use FreeAndNil not Free e.g.

procedure TfrmMain.ShowAbout;



I guess that makes me feel a little better.  :-)

I didn't know about FreeAndNIL.  The fact that the problem could be particular to Delphi5 and events occuring in a particular order makes sense.  Can you explain how (or if it is, in fact, possible), for a reboot not to fix it?
Top Expert 2004

>A component named MyEditDlg already exists
usual this error comes up, if you want to name a object with the same name of an already existing object

so it seems your dialog is not destroyed and resists already in the applications component-list

if FreeAndNIL can resolve this, don't know, because this dialog may used in other parts too,
or may autocreated  caused by the project-options

meikl ;-)
In a word No, I dont think its anything to do with a reboot but how the user is using the application. It may even be related to how many other programs are running and consuming resources. Check that the form is not being created at startup, one time I did make the mistake of leaving it as autocreate but and then trying to create it on the fly. Also check that there is no way the code allows for the form not to be freed, i.e. if the user clicks on the close X rather than a dialog button what happens, does the dialog allow any other flow path apart from returning to the calling form.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.