Solved

out of memory

Posted on 2000-02-29
7
235 Views
Last Modified: 2010-05-02
I get error 7 - out of memory from time to time.
If I close VB6 down and reload, it usually cures it, but sometimes I need to reboot.

Does this mean that my application is getting too big? If so is there any way to get around this?
0
Comment
Question by:broadbent
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 3

Expert Comment

by:Lewy
ID: 2570303
Make sure you unload everything properly.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2570436
Check how much free disk space you have.. <your swap file maybe is choking choked>.. If you use a permanent swapfile.. increase the size of the swapfile.

Note.. Permanent swapfile will improve performance. Click on start.. settings.. control panel.. system.. performance.. virtual memory.. let me specify my own settings.. put a number 2-3 times the amount of physical memory you have in BOTH MINIMUM and MAXIMUM.. (ie they are the same).

However, the principle cause of out of memory messages is lack of conventional memory space (the lower 640kb). Check your Config.sys and Autoexec.Bat files.. and REM (comment) out any unnecessary TSRs and/or Drivers. Also, as Lewy points out.. there are cases of programs with Memory leaks.. these are a killer.. make sure you unload everything properly before terminating your program.
0
 
LVL 1

Accepted Solution

by:
prozak earned 50 total points
ID: 2572770
We've run into this problem with VB5 and VB6. If is directly related to the number of forms in your project. It has nothing to do with the actual memory available on your machine. We're using machines with 256MB of RAM and when I get this message, according to NT I have over 100MB free! Increasing the memory and swap space on the machine did reduce the frequency of this error but we still receive it even though we have plenty of RAM. All you can really do is try to remove some of the forms from your project and implement them in DLLs.
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
LVL 4

Author Comment

by:broadbent
ID: 2573031
I had a feeling that this was happening although I am below the limits that Microsoft give.

I have no problems creating dll's - it just seems to get messy

As far as swap files go etc. I had already done that, and my config.sys etc. are pretty well paired to the bone as it is. But thanks
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2573096
Microsoft products (particularily VB) with memory leaks?.. Now who could ever believe that?.. <wink>. Only thing I can add is.. "get a quarter and call Bill Gates". LOL.
0
 
LVL 3

Expert Comment

by:Lewy
ID: 2573193
This code unloads all the forms of the program returning the resources back to the computer:
Private Sub UnLoader(Optional ByVal ForceClose As Boolean = False)
    Dim I As Long
    On Error Resume Next
    For I = Forms.Count - 1 To 0 Step -1
        Unload Forms(I)
        Set Forms(I) = Nothing
        If Not ForceClose Then
            If Forms.Count > I Then Exit Sub
        End If
    Next I
    If ForceClose Or (Forms.Count = 0) Then Close
    If ForceClose Or (Forms.Count > 0) Then End
End Sub

The “Set Forms(I) = Nothing” frees resources that cause an out of memory error.
0
 
LVL 4

Author Comment

by:broadbent
ID: 2574384
Thanks for all that, but I have similar code already.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question