Lag

hog

Senior Contributor
Joined
Mar 17, 2003
Messages
984
Location
UK
I find that if I have my app running which displays a mesh rotating in a viewport that after a time the pc starts to lag if I try to do anything else. Change focus to another app, move mouse etc.

Is there some form of garbage collection I might be not aware of?
 
Are you disposing of objects when you've finished with them? If not it is probably worthwhile trying that.
If you need to force GarbageCollection try GC.Collect().
 
I do dispose of the objects etc when say selecting another mesh etc. The lag seems to occur when the mesh is being rotated in the viewport. No disposing can take place here as the objects are in use?
 
? but I have looked through my code and eack proc that gets called releases any objects it creates prior to leaving?

There is definte lag as whilst the app is running if I open My Documents for example there is delay and the mouse cursor lags:(

I'll look again, any pointers on the best way to find if it is memory leak?
 
OK this is what is happening;

The render loop runs as usual ->

Render
Application.DoEvents

The application itself does not lag. But if I kick of the render loop and just leave it running then try to open up another app, folder etc there is a delay and the mouse jitters??

This is the code involved:

Visual Basic:
 Private Sub Render()

        Dim intX As Integer

        If m_obj3DDevice Is Nothing Then

            Return

        End If

        Try

            ' clear the backbuffer to the colour set by user, black when first run 

            m_obj3DDevice.Clear(ClearFlags.Target Or ClearFlags.ZBuffer, m_colBackColour, 1.0F, 0)

            ' begin the scene

            m_obj3DDevice.BeginScene()

            ' setup the world, view, and projection matrices

            SetupMatrices()

            ' meshes are divided into subsets, one for each material, render them in a loop

            For intX = 0 To m_matMaterial.Length - 1

                ' set the material for this subset

                m_obj3DDevice.Material = m_matMaterial(intX)

                ' draw the mesh subset

                m_mshMesh.DrawSubset(intX)

            Next intX

            'end the scene

            m_obj3DDevice.EndScene()

            ' display on screen

            m_obj3DDevice.Present()

        Catch objException As Exception

            ' bugger, somethings gone wrong, so tell user

            MessageBox.Show("The following error has occured during the render process" & ControlChars.CrLf & _
                            ControlChars.CrLf & objException.Message, "Mesh View ~ Render Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

            ' set flg to stop this code being called again

            m_blnRenderScene = False

        End Try

    End Sub
 
Mmm how odd!

I have just loaded the app on my PC at work and there is no loag as far as other apps are concerned but the animation is a bit jitty probably cos the Video Card is naff?

Running on an RM P4 1.8 GHZ, 512MB RAM and Intel(R) 82845G/GL 64MB the animation is jitty but no lag on other apps.

Running on a Mobile P4 2.2GHZ, 640MB RAM and GeoForce4 420 Go 32MB the animation is well smooth but other apps jitter????
 
Not sure if this is the answer but still looking into this on my laptop my graphics card and usb host both share IRQ7 and I have a usb mouse.

Me thinks could this be it? Anyone know the ins and outs of IRQs?
 
Back
Top