| Author |
Message |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
 Error: out of memory
in my program I constantly get the same errors "out of memory", indifferent if I choose int or short, e.g.
the upper limit of MapSize always is close to 32 or 34, but I supposed if I always choosed short instead of int, the upper limit of these arrays could be larger (maybe twice as large).
Do int variables need the same memory compared to short?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
Last edited by Ford Prefect on Wed Mar 12, 2008 6:04 pm, edited 2 times in total.
|
| Wed Mar 12, 2008 12:28 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
I think it may be the fact that you're declaring 6700+ variables technically (31*31*7+any other variables). It may be a namespace issue rather than physical memory available.
I don't recall off hand what the upper limit is for variables declarations... but I don't believe it's that high.
I'll take a look into this, however.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Wed Mar 12, 2008 4:59 pm |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
In ROBOTC, an "int" is 16-bits. This is common practice in many embedded systems that are memory constrained. Larger system may use a 32-bit default for "int". A short is 16-bits.
I recall that around 15000 bytes are available for variable declarations in ROBOTC so it is likely with other program declarations you may very well be running out of memory.
Also make sure you're using the latest version of ROBOTC. In an earlier version pointer and call by reference variables were sometimes being incorrectly allocated as the size of the "item" rather than a single pointer value. The code worked OK but it was wasteful on memory space.
|
| Sat Mar 15, 2008 11:27 pm |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
hello Dick,
thx for your reply.
In this case of my aStar algorithm and navigation programs it could be helpful if RobotC
char (signed byte)
declaration and conversiion to int (and back) worked without faults, because most of my map coordinates got a range from maximum -128 to 127.
But working with byte or ubyte or char causes many compiler and run time errors!
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Sun Mar 16, 2008 5:59 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
@tfriez:
could you find out, why I get the out of memory error?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Sun Mar 23, 2008 7:38 am |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
Send me your complete source code files at dickswan@sbcglobal.net and I will diagnose the problem. I cannot do it with simply code snippets.
|
| Sun Mar 23, 2008 3:33 pm |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
hello Dick,
I have already published the file here in the forum.
It's the A-star Algorithm, you'll find it under "Project discussion".
http://www.robotc.net/forums/viewtopic.php?p=1725&highlight=#1725
[EDIT]
The program works fine, but I just wanted to enlarge the Map
(mapsize now 30x30 (with an additional edge/margin, actually it's 31x31),
the limit for compilation is supposed to be close to 36x36,
but 50x50 (51x51) would be perfect).
Thx + regards
Helmut
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Sun Mar 23, 2008 3:45 pm |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
In order to save memory, I even tried to change all variable declarations from
short varname
to
byte varname
(as far as possible);
but calculating with these byte values (which are supposed to be signed, as you wrote some time) always gives calculation errors and converting errors from byte to int and back converting errors from int to byte as well!!
So something in RobotC program seems to be quite "buggy"
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Fri Mar 28, 2008 6:15 am |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
IN your code
Each array is 2048 bytes. 1024 elements x 2.
The output from the compiler V1.233 indicates:
Compile Statistics:
704 User Source file lines, 3,939 tokens
4,778 System Include file lines, 24,130 tokens
0 Errors, 19 Warnings, 0 Info Messages
12,919 Used memory locations (of 15000), 1 Tasks, 32 Procedures
6,692 Total code bytes, (after 936 bytes removed during optimization)
12,919 is about what's expected with six x 2K arrays plus other variables.
|
| Fri Mar 28, 2008 7:19 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
Thank you,
now that I know that 15000 bytes are the limt for variable space I understand the reason.
Change from short to byte makes runtime errors, so I need version 1.22 where the bugs have been fixed.
Where can I download version 1.22 ?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Fri Mar 28, 2008 10:17 am |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
I first posted about the 15K limit on this thread on March 16.
|
| Fri Mar 28, 2008 10:34 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
Thank you,
sometimes there were too many words in a reply.
But back to my answer:
where can I download version 1.22?
or when and where?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Fri Mar 28, 2008 10:57 am |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
By 5PM EDT today.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Fri Mar 28, 2008 11:17 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
please, WHAT?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Fri Mar 28, 2008 2:10 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
By 5:00pm (17:00) Eastern Daylight Time (-4 hour offset from GMT).
About an hour from now... if that's easier.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Fri Mar 28, 2008 3:55 pm |
|
|