Question Removing tabs with user control from tabpage

Grega

Active member
Joined
Jun 21, 2007
Messages
25
Programming Experience
1-3
Hi all,

I have a thing I am not sure if it is a problem but its weird to me and I don't understand it. So if anyone has any idea or explanation I would appreciate if you told me.

I have a application with a tabcontrol. I dynamically open new tabs on which there is a custom control which is made of a graph and a datagridview with data. I fill this from a csv file. when I open few tabs like this my application memory goes over 120 MB. When I remove the tab I call the dispose on the custom control and a dispose for the tab. But the memory stays where it was (120+MB). It goes down only if I minimize the program. And when I show it again its around 10MB.

Is this normal or am I disposing wrong?

Thanks for any help!

Greg
 
That's normal. The memory figure you see in the Task Manager is just what's allocated, not what's in use. When you minimise the app the GC runs and reclaims the unused memory. If the system needed that memory the GC would run then too, so the memory is available if it's needed.
 
Thanks for the explanation.
One more question here...is it than enough to just remove the tab from the tab control or do I have to explicitly dispose it (or even dispose the user control on the tab)

Thanks again.

Best regards,
Greg
 
If you won't be needing to add the TabPage back to the TabControl then you should dispose it. Because it's a control, disposing it will dispose all its child controls too.
 
Back
Top