Solved

Out of memory error 7, a discussion

Posted on 1998-11-12
7
470 Views
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.
0
Comment
Question by:vienna
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
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.

0
 
LVL 4

Expert Comment

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

Just how much are we allowed?

Concerned.
0
 
LVL 1

Expert Comment

by:rayford
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!
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 4

Expert Comment

by:idcanada
ID: 1444649
Rayford,
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.



0
 
LVL 1

Expert Comment

by:rayford
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)

0
 
LVL 3

Expert Comment

by:vikiing
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?

0
 
LVL 4

Expert Comment

by:idcanada
ID: 1444652
How many Public variables are we allowed?

0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

785 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