Solved

out of memory

Posted on 2000-02-29
7
223 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
Comment Utility
Make sure you unload everything properly.
0
 
LVL 14

Expert Comment

by:wsh2
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Author Comment

by:broadbent
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for all that, but I have similar code already.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now