MDI and Memory Problems


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: MDI and Memory Problems

  1. #1
    James Knowles Guest

    MDI and Memory Problems


    Hi,

    I having a memory problem with my MDI application. I
    cannot see to get to release the memory of the child forms
    when they are closed. I can also not get it release the
    memory of I think of my data out of the datasets. I
    implemented a close function which does the following in a
    child form.


    private void miniclient_Closing(object sender,
    System.ComponentModel.CancelEventArgs e)
    {
    oleDbConnection1.Close();
    oleDbConnection1.Dispose();
    oleDbConnection2.Close();
    oleDbConnection2.Dispose();
    oleDbConnection3.Close();
    oleDbConnection3.Dispose();

    ... <-SNIP ->

    in the child form which dispose and close of nearly all of
    the Dataconnection. But it seems to have little effect ?

    To check that I was not going mad I created a basic form
    with a button and label only on it. I create it as a child
    of the MDI and close it but I am still not releasing the
    memory of it. I know I am missing something possible with
    IDisposible or Dispose and GC stuff but does anyone have a
    good example of any ideas on releasing memory out of MDI
    applications...

    Any help would excellent, Thanks in advance.

    James

    P.S Apologies for posting what maybe a obivous
    question/answer ;-( .


  2. #2
    Jay Glynn Guest

    Re: MDI and Memory Problems

    The memory is not "released" when you close the forms, datasets etc. It is
    marked for gc (as long as nothing else is holding a reference). The gc will
    kick in when it feels like it. There was a 2 part article in MSDN magazine a
    while back that explained the gc process fairly well, you might want to look
    at that for the full story.

    http://www.msdn.microsoft.com/msdnma...00/gci/gci.asp


    "James Knowles" <j.knowles@laserrec.co.uk> wrote in message
    news:3d777d86$1@10.1.10.29...
    >
    > Hi,
    >
    > I having a memory problem with my MDI application. I
    > cannot see to get to release the memory of the child forms
    > when they are closed. I can also not get it release the
    > memory of I think of my data out of the datasets. I
    > implemented a close function which does the following in a
    > child form.
    >
    >
    > private void miniclient_Closing(object sender,
    > System.ComponentModel.CancelEventArgs e)
    > {
    > oleDbConnection1.Close();
    > oleDbConnection1.Dispose();
    > oleDbConnection2.Close();
    > oleDbConnection2.Dispose();
    > oleDbConnection3.Close();
    > oleDbConnection3.Dispose();
    >
    > .. <-SNIP ->
    >
    > in the child form which dispose and close of nearly all of
    > the Dataconnection. But it seems to have little effect ?
    >
    > To check that I was not going mad I created a basic form
    > with a button and label only on it. I create it as a child
    > of the MDI and close it but I am still not releasing the
    > memory of it. I know I am missing something possible with
    > IDisposible or Dispose and GC stuff but does anyone have a
    > good example of any ideas on releasing memory out of MDI
    > applications...
    >
    > Any help would excellent, Thanks in advance.
    >
    > James
    >
    > P.S Apologies for posting what maybe a obivous
    > question/answer ;-( .
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center