Re: Memory Leak?
Greg Young <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
Use a background thread and an event to notify the main thread that the background thread has found the keypressed. Or use the async pattern to do this. The simple fact of the matter is that you want two threads here not one. Cheers, Greg On Mon, Dec 1, 2008 at 2:47 PM, Dave Vorgang <[email protected]> wrote: > I have the following code that simply loops until _KeyEntered >= 0. The application works and the CPU in task manager shows 0. > > The problem I'm having is that the Mem Usage in Task Managers keeps incrementing at a fairly significant amount. Why would it do that? > > ''' <summary> > ''' This routine will loop until _KeyEntered is >= 0. > ''' _KeyEntered of 0 = Enter Key, 1 - 8 = Function Key, 9 = frmMain was Closed. > ''' </summary> > ''' <param name="comArea"></param> > ''' <returns></returns> > ''' <remarks></remarks> > Public Function VREADFIELDS(ByVal comArea As ComAreaDefinition) As Integer > _KeyEntered = -1 > > Do > System.Windows.Forms.Application.DoEvents() > Thread.Sleep(1) > Loop Until _KeyEntered >= 0 > > comArea.NumErrs = 0 > comArea.LastKey = _KeyEntered > > Return _KeyEntered > End Function > > Thanks, > > Dave Vorgang > Senior Programmer / Analyst > Medford School District - Information Technology > (541) 842-1021 > mailto:[email protected]<BLOCKED::mailto:[email protected]> > > > =================================== > View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives > -- It is the mark of an educated mind to be able to entertain a thought without accepting it. =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives