473,419 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

PageFile Usage increasing on every form change

Hi all,

I have an MDI app developed using vis studio 2005.
The problem I have is that evey time I close a Child form and open another, the CPU PF Usage increments slighty. This happens every time you change child forms until you run out of memory upon which you get a System.OutOfMemoryException.

Is there something subtle I'm missing about dealing with opening/closing MDIChild forms?

I have made sure only 1 child is open at one time and that all child forms are disposed of before opening another:

Public Sub CloseForms()

Dim frm As Form
Dim Count As Integer
For Each frm In MDIParent1.MdiChildren
Count = Count + 1
frm.Dispose()
Next
frm = Nothing
Count = Nothing

End Sub

I also put in an extra sub to dispose of all controls on every child form when each closing:

Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
frmMainOptions.Dispose()

Dim FormControl As Control
For Each FormObject In Me.Controls
FormControl.Dispose()
Next
End Sub

I also force a garbage collection on every child form change:
System.GC.Collect()

As far as I can think, nothing I have declared/programmed is increasing in size with every screen change.

I've run out of ideas!
Nov 15 '07 #1
3 1320
mzmishra
390 Expert 256MB
Check this

http://www.thescripts.com/forum/thread362016.html
Nov 15 '07 #2
Thanks 4 the reply and link

I took the comments raised on board and if I understood it, I tried changing the child forms this way:

Public Sub NewForm(ByRef MyNewForm As String)

Dim frm As Form
Dim Count As Integer
For Each frm In MDIParent1.MdiChildren
Count = Count + 1
frm.Close()
frm.Dispose()
Next
frm = Nothing
Count = Nothing

Dim Child As New Form
Try
Select Case MyNewForm
Case "frmAlarm"
Child= New frmAlarm
Case "frmGuard"
Child= New frmGuard
Case "frmMain"
Child= New frmMain
End Select
Catch ex As Exception
Exit Sub
End Try

Child.MdiParent = MDIParent1

Try
Child.Show()
Child.Update()
Catch ex As Exception
End Try

System.GC.Collect()

End Sub

Still no dice, the memory still rises.
Nov 15 '07 #3
Plater
7,872 Expert 4TB
Please don't double post.
http://www.thescripts.com/forum/thread736851.html
Nov 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: Bryan Rickard | last post by:
I wrote a simple program in VB6 to copy all the files from a directory on a CD-ROM to my hard disk. There are about 10 files, each about 30MB. The program uses Get and Put to get data from the...
0
by: KenH | last post by:
I have a MDI C# Windows form application that increases its memory usage about 4k every second - even with all of the child windows closed. I have seen other posts about similar problems,...
1
by: marko | last post by:
Here is my problem. How can i make a field in a form change to a value 1 every morning when I turn access on, when the date changes? And how can i make a button on a form which would open another...
20
by: Philip Carnstam | last post by:
How come .Net applications use so much memory? Every application I compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the...
4
by: Dan K. | last post by:
Hi NG, first of all i am new to OOP and C# so maybe thats my whole problem :) i wrote a small timer application, like i did if i was starting with programming in vb long time ago. the vb...
4
by: Andrew Ward | last post by:
Hi All, I was wondering if it is possible to use precompiled headers without having to include a <stdafx.h> or whatever in every source file. My problem is that I have a project that makes heavy...
3
by: tlyczko | last post by:
Hello, I've been reading about this topic, and I've gotten myself more confused, not less. We have a single-processor license SQL Server Standard 2005 (xeon 2.8 ghz) with 4 GB RAM in Windows...
2
by: Amit Dedhia | last post by:
Hi I am developing a scientific application which has moderate level image processing involved. In my application, there is a main application form which invokes another form. When this form...
7
by: narpet | last post by:
Hello all... I'm having a problem moving my swap file to a drive other than my primary drive. Right now I have a 3+ gig pagefile.sys that resides on my C drive. When I try to reconfigure (through...
2
by: chrispy102 | last post by:
Hi all, I have developed a .Net app in MDI format. The problem that I have is that every time I change screens (New Child), the PC CPU PageFile usage increments a little. This happens until out of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.