Memory vs. Amount of Data
-
- Posts: 29
- Joined: May 28, 2006 18:32
- Location: denmark
Memory vs. Amount of Data
Does the size of memory and amount of data have any relations?
Problem is that when IF...TO...NEXT reads data the machine stops(error) after reading just a few(12) data lines.
A more elaborate description of the problem can be submitted, if this programme don't drop out! Which has happened
several times.
Yours sincerely
Niels Olse
Problem is that when IF...TO...NEXT reads data the machine stops(error) after reading just a few(12) data lines.
A more elaborate description of the problem can be submitted, if this programme don't drop out! Which has happened
several times.
Yours sincerely
Niels Olse
-
- Posts: 1186
- Joined: May 08, 2006 21:58
- Location: Crewe, England
Re: Memory vs. Amount of Data
As far as I remember, you should by default get a megabyte of dynamic memory to play with, so unless your data records are enormous it's probably some other bug. Suggest you examine the last record processed against your code, and maybe put in a few print and sleep statements to check how far you get before the bug hits.
Re: Memory vs. Amount of Data
Feel free to post some code.
-
- Posts: 2958
- Joined: Jun 02, 2015 16:24
Re: Memory vs. Amount of Data
@fxm, I don't remember the command that shows the avaiable memory in stack, like say __mem__. Or have I been dreaming?fxm wrote:Feel free to post some code.
Re: Memory vs. Amount of Data
I know only this method:Tourist Trap wrote:@fxm, I don't remember the command that shows the avaiable memory in stack, like say __mem__. Or have I been dreaming?fxm wrote:Feel free to post some code.
http://www.freebasic.net/forum/viewtopi ... 47#p161347
-
- Posts: 2958
- Joined: Jun 02, 2015 16:24
Re: Memory vs. Amount of Data
Thanks.fxm wrote: I know only this method:
http://www.freebasic.net/forum/viewtopi ... 47#p161347
-
- Posts: 29
- Joined: May 28, 2006 18:32
- Location: denmark
Re: Memory vs. Amount of Data
Sorry for I have troubled you. I have solved my problem, by correcting my programme!!!!!!
Your sincerely
Niels
However, I have got an other question:
FOR n = 1 TO 20
.
.
NEXT
If you write 'n = 5' the loop still starts from 1(one).
Is this a bug? or do I make an programming error?
Yours sincerely
Niels Olsen
Your sincerely
Niels
However, I have got an other question:
FOR n = 1 TO 20
.
.
NEXT
If you write 'n = 5' the loop still starts from 1(one).
Is this a bug? or do I make an programming error?
Yours sincerely
Niels Olsen
-
- Posts: 2958
- Joined: Jun 02, 2015 16:24
Re: Memory vs. Amount of Data
This depends. If you do:niels olsen wrote: FOR n = 1 TO 20
.
.
NEXT
If you write 'n = 5' the loop still starts from 1(one).
Code: Select all
dim n as integer
for n = 1 to 20
if n=1 then n = 5
print n
next n
(you can use the CODE button to write code on the forum)
-
- Posts: 1186
- Joined: May 08, 2006 21:58
- Location: Crewe, England
Re: Memory vs. Amount of Data
You can start your loop with
and the program will set up a new instantiation of n within the scope of the loop.
Otherwise it uses the previously declared variable n and runs the loop. This is more useful if you are searching an array, e.g.
If you want to start the loop at some other value, then use a while-loop:
Code: Select all
For n AS INTEGER = 1 to 20
Otherwise it uses the previously declared variable n and runs the loop. This is more useful if you are searching an array, e.g.
Code: Select all
for n= 1 to 20
if input_key = table_key(n) then exit for
next
if n<=20 then
print "Input key is in table"
else
print "Input key is not in table"
endif
Code: Select all
n = 5
...
while n<=20
rem do something
n+=1
wend
Re: Memory vs. Amount of Data
"Stack Overflow Problems on different platforms" - founded here http://www.cs.nyu.edu/exact/core/doc/stackOverflow.txtfxm wrote:I know only this method:Tourist Trap wrote:@fxm, I don't remember the command that shows the avaiable memory in stack, like say __mem__. Or have I been dreaming?fxm wrote:Feel free to post some code.
http://www.freebasic.net/forum/viewtopi ... 47#p161347
contains solution for Linux, nice ;)
Insufficient stack size can be one reason of segfaults.