Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unloading dynamic control array - memory leak

Status
Not open for further replies.

tenshekels

Programmer
Feb 5, 2004
20
US
I have a control array of items that I have to constantly have to dynamically add/remove items from (depending on the position of a scrollbar).

The problem is that eventually the size of the control gets bigger and bigger.

I use the "Load sections(intCtr)" to load a new control dynamically.
And when I unload the control I use...
"
for each ctlSec in Sections
if (ctlSec.visible = false) then
unload ctlSec
set ctlSec = nothing
end if
next
"

Is there something that I am doing wrong when I am unloading the resource? Is there a possible reason why the size of the control gets gradually bigger over time?
 
WHy do you unload the controls each time? I have a scrolling picture box that contains in the region of 3000 controls - labels and text boxes. Using the fact that the picture box scrolls, I can then ensure the user only ever sees 500 at a time, without unloading and reloading data and controls.

If you explain what you are trying to achieve with the scrolling and unloading, then there may be an easier way. There may not, but it is worth a shot, and uses alot less memory.

BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top