Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insufficient Memory error
Message
 
 
To
27/05/1998 21:49:36
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00102433
Message ID:
00102605
Views:
30
Dave,

Here's something else I saved from a newsgroup message back in April. Maybe it'll help too.

--------paste
I first noticed something peculiar with the Insufficient Memory error in my
program - a popup control with over 500 elements would cause an
Insufficient Memory error in one part of the program, but a second popup in
another part of the program using the same array did not. I posted these
observations to the newsgroup a while back, but didn't really get the
amount of discussion I had hoped for. So I dropped the problem popup
control altogether and forgot about the whole thing - except for my almost
daily visits to MS to check their KB articles on the subject!!!! But
earlier this week, I decided to sit down and compare the two original parts
of the code to try to see how one would work and the other one wouldn't.
What I eventually found was that how the for a popup or listbox
control is initially defined does play some part in causing an Insufficient
Memory error. BTW, I was doing my tests on a P233 with 64 MB RAM running
Windows NT. The Language Reference guide states that the can be
of numeric or character type. In my particular case I was using a
character type field. Furthermore, I was assigning a default value to this
variable before the @ GET was issued to display the popup control to which
it was associated. I was simply setting ' ' as the default. THIS WAS MY
PROBLEM! It would appear that setting the character variable to a value not
contained in the array would cause an Insufficient Memory error on fast
computers when the array had over 500 or so elements. Here's an example:

*****This program run on my P233 would consistantly cause an Insufficient
Memory error
**** PROGRAM 1 START

m.elcount = 700 && Number of elements in array
m.select = "" && Variable used to store popup control
selection

DIMENSION testar(m.elcount) && Setup test array

FOR n = 1 TO m.elcount && Populate array
testar[n] = "TEST"+ALLTRIM(STR(n))
ENDFOR

**** Setup small window to display popup control
DEFINE WINDOW testpop AT 18,25 ;
SIZE 8,80 ;
FONT "Arial",9 ;
TITLE "Test" ;
FLOAT ;
COLOR RGB(,,,192,192,192)
MOVE WINDOW testpop CENTER

ACTIVATE WINDOW testpop
@ 2,2 SAY 'Test:' FONT"Arial", 9 STYLE "BT"

**** Issuing the following statement would cause IM error

@ 1.25,14 GET m.select ;
PICTURE "@^" ;
FROM testar ;
SIZE 1.538,56.200 ;
FONT "Arial", 9 ;
DEFAULT 1

READ MODAL

RELEASE WINDOW testpop

**** PROGRAM 1 END




Now compare with this program:

*****This program run on my P233 would not cause an Insufficient Memory
error
**** PROGRAM 2 START

m.elcount = 700 && Number of elements in array

DIMENSION testar(m.elcount) && Setup test array

FOR n = 1 TO m.elcount && Populate array
testar[n] = "TEST"+ALLTRIM(STR(n))
ENDFOR

m.select = testar[1] && Variable now assigned first array
element

**** Setup small window to display popup control
DEFINE WINDOW testpop AT 18,25 ;
SIZE 8,80 ;
FONT "Arial",9 ;
TITLE "Test" ;
FLOAT ;
COLOR RGB(,,,192,192,192)
MOVE WINDOW testpop CENTER

ACTIVATE WINDOW testpop
@ 2,2 SAY 'Test:' FONT"Arial", 9 STYLE "BT"

**** The following statement would no longer have problems.

@ 1.25,14 GET m.select ;
PICTURE "@^" ;
FROM testar ;
SIZE 1.538,56.200 ;
FONT "Arial", 9 ;
DEFAULT 1

READ MODAL

RELEASE WINDOW testpop

**** PROGRAM 2 END

Another way I got the program to work was to not assign an initial value to
m.select at all. Instead it would default to a numeric type and be assigned
a value of 1 - this is where the DEFAULT 1 clause in the @ GET comes into
play. Further testing this morning showed that I would also get an error
by setting the initial value of the variable to an array element above 500
(e.g., m.select = testar[610]); however, setting m.select to the position
value instead seemed to work (e.g., m.select = 610).

I've not had a chance to try this out on other systems or do additional
tests - I guess this is where I hope that others will now pick-up the
ball....

Good luck and keep this thread alive with your own results.

Marc
--------endpaste

>Thanks for the URL David, I hadn't been able to find it yet myself - was going to try again tomorrow! Anyway, the APP does seem to run fine on a Pentium MMX 200Mhz machine (w/32 MEG RAM) with a particular MEMLIMIT setting, but gives the Insufficient Memory error on a PentiumII 300Mhz machine (w/64 MEG RAM). I'll try some more of the other suggestions in the MS KB article tomorrow as well as playing some more with the MEMLIMIT settings.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform