Memory Leak
Posted: Sun May 13, 2007 4:33 pm
We have an application with a database of users. You can select a user then generate a report for the selected user. The report is shown onscreen (using report.Show(true)). After the report is shown the you can print/save/email the report, then you can close the report, go back to the application, choose another user, and generate the report again etc etc.
We find that everytime we generate another report the memory usage goes up. Sometimes by 30mb, sometimes by only 10mb, but it always goes up. This is both virtual memory and physical memory. After many times of doing this we managed to get the memory usage to 2gb (both virtual and physical), then we'd get strange errors.
We feel we may not be creating reports in the most efficient way. Here is how we create the reports.
1. Report object is created - we have a wrapper class for the report
2. Report file is loaded using report.Load(filename)
3. Register data to report by using report.RegData(name, dataset)
4. Shows the report by using report.Show(true)
When the report is closed, another use can be selected and steps 3 and 4 are executed again. This happens every time a new user is selected.
Are we doing something wrong? Or is there a better way of using the report?
Thanks
We find that everytime we generate another report the memory usage goes up. Sometimes by 30mb, sometimes by only 10mb, but it always goes up. This is both virtual memory and physical memory. After many times of doing this we managed to get the memory usage to 2gb (both virtual and physical), then we'd get strange errors.
We feel we may not be creating reports in the most efficient way. Here is how we create the reports.
1. Report object is created - we have a wrapper class for the report
2. Report file is loaded using report.Load(filename)
3. Register data to report by using report.RegData(name, dataset)
4. Shows the report by using report.Show(true)
When the report is closed, another use can be selected and steps 3 and 4 are executed again. This happens every time a new user is selected.
Are we doing something wrong? Or is there a better way of using the report?
Thanks