Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


out of memory

Posted on 2000-02-29
Medium Priority
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
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

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 150 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.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


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

Independent Software Vendors: 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
Suggested Courses

618 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