[Webinar] Streamline your web hosting managementRegister Today


Out of memory error 7, a discussion

Posted on 1998-11-12
Medium Priority
Last Modified: 2012-06-27
Out of memory error 7

Ladies and Gentlemen,

I seek your information concerning my application that
at odd times falls into a "Out of Memory Error 7"

As with any product that you are about to put out on
the market, as a professional developer, you want to make
sure that your application is idiot proof.

Since the world keeps on making better idiots,
I feel the need to constantly revise and better my code.

I can not tell you how disappointed I am when I fall upon
a "Out of Memory Error 7". My application can run fine for
hours and then fall upon one of these.
Never during the same action or at the same place.

I ask you, to please share your comments or knowledge
concerning this issue. I am overwhelmed, and have no idea
what to do.

Thank you.
Question by:vienna
  • 3
  • 2
  • 2

Accepted Solution

vikiing earned 0 total points
ID: 1444646
Error 7 appears when more memory was required than is available, or a 64K segment boundary was encountered. Based on Microstuff comments, this error is due to some of these reasons. Take a look at possible solutions:

You have too many applications, documents, or source files open.

Close any unnecessary applications, documents, or source files that are open.

You have a module or procedure that is too large.

Break extremely large modules or procedures into smaller ones.  This doesn't save memory, but it can prevent hitting 64K segment boundaries.

You are running Microsoft Windows in standard mode.

Restart Microsoft Windows in enhanced mode.

You are running Microsoft Windows in enhanced mode, but have run out of virtual memory.

Increase virtual memory by freeing some disk space, or at least ensure that some space is available.

You have terminate-and-stay-resident programs running.

Eliminate terminate-and-stay-resident programs.

You have many device drivers loaded.

Eliminate unnecessary device drivers.

You have run out of space for Public variables.

Reduce the number of Public variables.


Expert Comment

ID: 1444647
You have run out of space for Public variables???

Just how much are we allowed?


Expert Comment

ID: 1444648
It seems like more of an operating system defect under Windows95 because my application is only getting error 7's under 95 and never under NT.  There is a large Public variable and a form module which if just over 100k but this is absurd to expect that a single large PV will cause errors only under Windows 95?  (using vb5 w/sp3 here).  There is no way to keep some form modules under 64k when you need treeview and wang imgedit controls on them you are starting out at 64k before you start writing code!
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.


Expert Comment

ID: 1444649
would you mind working with me on this matter?
Hopefully, we can better our products in this process by sharing our findings.

Give me your email address.


Expert Comment

ID: 1444650
Vienna,  any application which does not error right at startup (as with mine) but does so later on is experiencing some sort of memory leak.  

Watch your use of exit sub and exit function calls etc. Replace those with goto bottom and put bottom: at the very end of the function so it will reach the actual natural END FUNCTION statement to return.  Also try to limit your jumps out of the middle of loops and try not to nest your FORS and IF's too deeply.  

Obviously be very careful of recursion and make certain it actually returns on recursive calls to the original first calling layer. (although those tend to eat up the stack before the memory)


Expert Comment

ID: 1444651
Just a question, Rayford: ¿why you suggest a GOTO BOTTOM (with BOTTOM label pointing to END FUNCTION/SUB?; EXIT FUNCTION/SUB does exactly the same (it generates a RET machine-instruction, as EXIT SUB does).

Besides that, ¿what's the intended purpose of EXIT SUB if it doesn't work properly?; perhaps VB has a bug involving that, but just think of this: if there were any thing remaining at stack (where return addresses are stored), because EXIT SUB works different from END SUB, then the program will surely die almost immediately each time control returns from a SUB with EXIT. ¿Have you experienced something like that?


Expert Comment

ID: 1444652
How many Public variables are we allowed?


Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
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…
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
Course of the Month9 days, 18 hours left to enroll

591 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