Link to home
Start Free TrialLog in
Avatar of bmccleskey
bmccleskey

asked on

Hanging on frm.show when the business object contains a collection w/ > 5000 objects

The following roughly describes the sequence of events:

- mdi menu click event asks the business tier to populate an object

- parent business object calls the database and populates itself.  This includes a collection of 5000 child objects.  While debugging I can see that this successfully completes

- control returns to the MDI form where it Dims a windows form

- the windows form is successfully given a reference to the business object

- frm.Show is called

Execution in the debugger runs as expected until frm.show is called.  At this point execution hangs, CPU usage redlines, the form never appears, and I eventually stop the debugging (or, if I am running without the debugger, I must kill the program).  I can successfully load the form when I have only 1000 child objects.  Why would 5000 cause this failure... out-of-memory comes to mind, but why would it not fail while the 5000 objects are being created?  Furthermore, 5000 hardly feels like a "scary" number!

Thank you in advance for pointing me into the right direction to uncover my error!
ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bmccleskey
bmccleskey

ASKER

You pointed me into the right direction, and it was a silly mistake on my part.  I had assumed that execution was not making it into the form load event, so I didn't have a breakpoint set within the "being created" form.  Once I set the breakpoint and stepped into the form_load event, the bug in my looping logic was easy to spot.

A million thanks.
glad you got it.