Solved

out of memory

Posted on 2000-02-29
7
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 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