CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Posts
    2

    Memory Leak in VB App. Pls. Help

    Hi,

    Our reporting system consists of individual VB 6 32-bit (ported from 16-bit)executables that basically query data from a database, lay it out, and print it. We use a preview form with minimal controls that include a couple of graphics controls from Graphics Server 5.10 (that we've just upgraded to 5.40), four picturebox controls, some buttons, and two scrollbars.

    We have found that each run of our executables causes 75K of memory to be leaked when run on Windows 95/98. We do not see the leak in NT. The exe's do allocate more memory at run time, but frees most allocations except for 75K.

    It appears that 60k is lost with just loading the form. I found this by unloading the form just after loading. I've also systematically removed each control, but it didn't seem to have a significant impact on the leak.

    We use Visual Studio 6 with SP 3. Please help.

    Thanks,
    JVR


  2. #2
    Join Date
    Jan 2000
    Posts
    11

    Re: Memory Leak in VB App. Pls. Help

    Try to put this code in your application right before ending it....

    public sub TerminateApp()
    Dim tmpForm As Object
    ' loop to close all forms
    On Error Resume Next
    For Each tmpForm In Forms
    Call Unload(tmpForm)
    Set tmpForm = Nothing
    Next
    On Error GoTo 0
    End
    End Sub


  3. #3
    Join Date
    Jan 2000
    Posts
    2

    Re: Memory Leak in VB App. Pls. Help

    Thanks for the reply. It really made sense and I've applied it.

    Unfortunately, I am still getting the same amount of memory loss (approx 80K). I wonder if you have any more suggestions. As I mentioned, the problem only appears in Windows 95/98 and the app is compiled in VB 6 sp 3.

    Thanks again.

    p.s. I would have replied sooner, but my system went down and I had to reinstall NT and all my software. Yuk.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured