• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2032
  • Last Modified:

Runtime error #7 - out of memory

I've developed a Visual Basic 6.0 program that displays some data (gathered from a Access database throw ODBC). This program works fine in my computer, under Windows 2000 but in eveery other computer with Windows 9x shows a runtime error #7 "Out of memory".
Please help!!
thanks a lot

p.s. even in my own computer with windows 98 and the very same software installed gets the #7 error.
0
krahd
Asked:
krahd
  • 3
  • 3
  • 2
  • +5
1 Solution
 
AJAY CHADHACommented:
Increase the virtual memnory size and make sure that you have installed the latest service pack i.e. SP5

Good Luck...
Ajay Chadha ... :-)
0
 
deightonprogCommented:
Do you create any large arrays, strings or collections in your program?  

Use error handling code to check what it is doing when it runs out of memory.  

Don't hold huge amounts of data in memory.
0
 
morgan_peatCommented:
Are you getting back loads of data?
Your machine should basically have the same amount of memory as hard disk+RAM.
When running in Win2K, try using the performance monitor to make sure you haven't got a memory leak somewhere.
Check Process->Private Bytes->Your running app.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
anthony_glenwrightCommented:
Usually when I get this error, it's because of an infinite loop or infinite recursion problem.  Does it happen at design time as well?  If so, bung in a couple of break points or click ctrl-break and see what's happening...
0
 
krahdAuthor Commented:
Thank you all for your comments.
What I have is a form named fMainForm with a lot of controls in it.
I have 400+ textboxes and 200+comboboxes, divided in 11 "pages" using frames and a TabStrip (by toggling the visible propertie of the frames).
I have also, 6 forms that access some other data using dataGrids.
The program checks the database and fills the controls fMainForm up.
Then the user is allowed to make some changes, but when he tries to save them he gets the #7 error.
The amount if data involved is not really big, just what is needed to fill the controls up.
Every procedure I used is far smaller than 64kb, but the "text size" of fMainForm is 437 kb (300 just due controls declarations).
I do not have infinite loops, and the biggest collection I have has less than 60 objects.
Anyway, what I cannot explain is: why do I get the error udner windows 9x & ME but it does NOT appear under Windows 2000?

Thanks a lot again.
krahd
0
 
anthony_glenwrightCommented:
You might be running out of system resources, with that many controls on a form.  I *think* in Win95 there's still a limit, it was just increased.

Are you using control arrays for the multiple text boxes and combo boxes?
0
 
krahdAuthor Commented:
Hi again.
I'm using control arrays for both text and combo boxes.
I use one array for each type of control for each page. Id est I have 22 arrays (11 per type).

I forgot to mention that there are a lot of labels too, one per control (describing the info contained) Arranged in one array per page, too.

Thanks again.
Krahd.

P.S. Could it be a bug in ADO software?
0
 
anthony_glenwrightCommented:
I'd be checking system resources, then.  Run sysinfo and have a look...
0
 
morgan_peatCommented:
Theres a good knowledge base article about this: Q229756
(http://support.microsoft.com/support/kb/articles/Q229/7/56.ASP)

I quote:
"Although you can have up to 254 control names in a form ... In some cases, you will experience out-of-memory error. ".


It also explains a few ways to get around it (i.e. UserControls, control arrays).
Best way is to try and cut down the size of your forms though.....
0
 
bosleyCommented:
Hi krahd, we have just gone through the exact same problem on our project.  I had a form with a grid and 2 tab controls.  The main tab control had 8 tabs and about 50-60 controls on it.  We found we had to break this form up. When this form was loaded our Win 95 systems took over a 25% resource hit (looking at the resource monitor).  what we did was to break up each of the tabs to a sub-form that is loaded on the click of a button from the main form (fMainForm).  So instead of 8 tabs we have 8 buttons. From the user's point of view they either have to click on the tab they want (old version) or a button (new version).  This reduced the resource hit from 25% to about 5%.  Your case may be a lot more of a savings because you have more controls than we did.

Just a suggestion.

bosley

0
 
krahdAuthor Commented:
Hi again.
First af all I would like to give thanks to all who took the time to answer. Thans :)

Bosley: As far as I remember the subform (a la Access) feature isn't present in Visual Basic...
but if it is, could you please tell me how to do it? :)

(I've made a prototype where another form was loaded by frmMain (but not a subform) but it was rejected...)

Thanks again,
   Krahd.



0
 
bosleyCommented:
krahd,

You create a forms (nothing special about the forms I just call them "sub forms") that contains the controls from your tabs. Next, you replace your tab control with, for example, buttons.  Each button corresponding to one tab on the tab control you removed. In the click event of the buttons on the main form you will open the corresponding form containing the controls previously on your tab:

private sub button1_click()
   form2.show
end sub

You can also use "form2.show vbModal" if you want the user to complete that form and close it (I assume this would trigger a save) before continuing with other processing on your main form.

I would suggest that each "sub form" corresponds to one table of data to make the inserts and updates, etc a lot more straight forward.

Hope this helps.

bosley
0
 
JanusFuryCommented:
Using that many controls is sure to cause your problem. I suggest using a static number of text boxes, and having them visible no matter what tab is chosen... then change the appearance of them to reflect the chosen tab.
0
 
NetminderCommented:
Force-accepted by
Netminder
CS Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 3
  • 3
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now