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

out of memory

Posted on 2000-02-29
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?
Question by:broadbent
  • 2
  • 2
  • 2
  • +1

Expert Comment

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

Expert Comment

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.

Accepted Solution

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.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Author Comment

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
LVL 14

Expert Comment

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.

Expert Comment

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.

Author Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
change vba from autofit to 13.5 width? 4 29
Windows 10 start screen issues 9 55
using Access 8 75
MsgBox 4 68
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

808 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