Jump to content
PiedSoftware

Opening form takes 1 minute in debugger, 2.5 s without

Recommended Posts

Hi

 

I have been trying to work out what is going on with one of my forms. Just opening it, which has only a small amount of DB activity, was taking nearly a minute in the debugger, once it was about 35s. But when I run it without the debugger it is less than 3 seconds. There is no obvious bottlenecks in Task Manager. I have 8 GB of RAM.

Does this sound familiar to anyone? Does anyone have a possible solution?

Regards
Mark

Share this post


Link to post

What version of Delphi? At runtime or design-time in the IDE?

 

What database? What type of activity--I assume at least connecting?  Is it using the same connection in debug and release modes? Are the release and debug configs generating executable in different directories? Perhaps it loading a configuration from an .INI file which is in one location but not the other?

 

After the form is loaded, does everything run fine (assuming this is at runtime)?

 

There are so many things this could be--we need a little more information.

Share this post


Link to post
2 hours ago, corneliusdavid said:

What version of Delphi? At runtime or design-time in the IDE?

 

What database? What type of activity--I assume at least connecting?  Is it using the same connection in debug and release modes? Are the release and debug configs generating executable in different directories? Perhaps it loading a configuration from an .INI file which is in one location but not the other?

 

After the form is loaded, does everything run fine (assuming this is at runtime)?

 

There are so many things this could be--we need a little more information.

Delphi 10.4

MySQL, but I don't think that is the issue. I probably shouldn't have mentioned it. It was my first thought, I put timings in the code. The time is just the form getting created, with no database activity.
It looks fine when it has loaded

 

Yes, I know it's pretty diffuse. I haven't started pulling my hair out yet.

Share this post


Link to post

Does removing all breakpoints (Ctrl+Alt+B), Watches, or closing Local variables frame help?

Do you see stuff popping up in the Events-frame?

Old dcu or dcp files?

Edited by Pieter Bas Hofstede

Share this post


Link to post
16 minutes ago, PiedSoftware said:

Delphi 10.4

MySQL, but I don't think that is the issue. I probably shouldn't have mentioned it. It was my first thought, I put timings in the code. The time is just the form getting created, with no database activity.
It looks fine when it has loaded

 

Yes, I know it's pretty diffuse. I haven't started pulling my hair out yet.

If components such as DBEdit, DBGrid or similar (dataware components) are present in the Form and these are active at RunTime, it may be that the delay is linked to the connection timeout with the DB engine.

Share this post


Link to post
10 hours ago, PiedSoftware said:

But when I run it without the debugger it is less than 3 seconds.

If it runs fine in debug mode but then you compile in release mode (which I think is what you mean), is there a conditional in your code that sets up the database connection differently for debug mode, like maybe you're using a local database for testing but the release mode one is connecting remotely for the customer?

Share this post


Link to post
10 hours ago, corneliusdavid said:

If it runs fine in debug mode but then you compile in release mode (which I think is what you mean), is there a conditional in your code that sets up the database connection differently for debug mode, like maybe you're using a local database for testing but the release mode one is connecting remotely for the customer?

Thank. What I am comparing are the 2 functions from the Delphi Run menu: Run (f9) and Run without debugging (shift-ctrl-f9)

Share this post


Link to post
Just now, PiedSoftware said:

I don't think we have that package in the app at all. We certainly haven't coded that way.

Okay but it's installed in the IDE by default and it affects the design-time performance of forms and datamodules.

Give a try; It's one of the first things I do when I install Delphi.

Share this post


Link to post

Another thing to try:

  • Use SysInternal's Process Explorer to inspect the call stack the threads in the process while it's running in the debugger. Might give you a clue about what it's doing.
  • Run Delphi in a debugger (you can use another instance of Delphi to do that). Then run your application in the other Delphi and break so you can examine the call stack.

Share this post


Link to post
5 hours ago, Anders Melander said:

Okay but it's installed in the IDE by default and it affects the design-time performance of forms and datamodules.

Give a try; It's one of the first things I do when I install Delphi.

I went to Component | Install Packages and unchecked "Embarcadero LiveBindings Components" and saved, but when I closed and reopened Delphi, it was back on again. D'oh! 

I'm concerned the maybe a library is using it. How can I work that out? Should I remove it?

Edited by PiedSoftware

Share this post


Link to post
3 hours ago, PiedSoftware said:

I went to Component | Install Packages and unchecked "Embarcadero LiveBindings Components" and saved, but when I closed and reopened Delphi, it was back on again. D'oh! 

I'm concerned the maybe a library is using it. How can I work that out? Should I remove it?

The Install packages dialog affects the current project only if you have one open, and the IDE basic configuration if you have no project open. Changing the latter will not affect any projects you created before, though. To get rid of the package for good you have to edit the registry key HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\21.0\Known Packages (for D10) and rename the items for the dclbind*.bpl packages or move them top the "Disabled Packages" key.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×