Why my form cannot release resources(such as memory)?

Hey,
I have a MDIParentWindow ,and I open a MDIChildWindow from it.This
MDIChildWindow is using CrystalReportViewers to show some Crystal report
documents.But I noticed after I closed this MDIChildWindow ,the system
resources used by this MDIChildWindow were not released.If I open and
close this MDIChildWindow again and again,it happenned everytime.Would
you please tell me what's the problem
Appreciate for any help.

In MDIParentWindow I wrote the following code:

AdvancedReport TodayReport = new AdvancedReport(DateTime.Today,
DateTime.Today);

if (TodayReport.CanBeShown)
{
TodayReport.MdiParent = this;
TodayReport.Text = "Today's Report";
TodayReport.Show();
}
else
{
TodayReport.Dispose();
}




Answer this question

Why my form cannot release resources(such as memory)?

  • Judge Of Nights

    I am having the same issue as the above posters. Does anyone have any other ideas
  • Nirvana

    mewdied,

    Thanks a lot.

    I tried to add the following code at the FormClosing Event handle:

    private void AdvancedReport_FormClosing(object sender, FormClosingEventArgs e)
    {
    //AdReportAllDataTable is Crystal report document
    AdReportAllDataTable1.Close();

    }

    and I also added the following code at the FormClosed Event handle:

    private void AdvancedReport_FormClosed(object sender, FormClosedEventArgs e)
    {


    AdReportAllDataTable1.Dispose();
    AdReportAllDataTable1 = null;
    //crpvAllDataTable is a Crystal report viewer
    crpvAllDataTable.Dispose();
    }

    Well,It works a little bit,but cannot solve all the problem.


  • shy_man

    At first,I was wondering maybe there is something worry with my program.I checked it carefully and I found nothing.After I tried to run the sample code carried with VS2005,I got the same result..
  • Kikala

     JungleFreak wrote:
    I am having the same issue as the above posters.  Does anyone have any other ideas

    I'm having the same problem too. My form uses about 80M memory at the first time and doesn't free memory. Anybody have solved this.



  • RatOmeter

    try using the close method of the report document before disposing it
  • Monarghel

    I'm using .Net 2.0 and CR for VS2005, I also have the same problem, my application consume near 200mb of memory once I open a report in CrystalReportViwer, and memory is not free when I close the MDI form with CrystalReportViwer.
  • Why my form cannot release resources(such as memory)?