memory limit at 64 KB ?

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

memory limit at 64 KB ?

Postby nefast » Wed Oct 12, 2011 1:31 pm

hello experts,

after some programming I ended up with the following error message: :shock: :shock: :shock:

Linking ...
js.tinyvm.TinyVMException: Offset out of range (65603)
at js.tinyvm.WritableDataWithOffset.initOffset(WritableDataWithOffset.java:22)
at js.tinyvm.RecordTable.initOffset(RecordTable.java:212)
at js.tinyvm.RecordTable.initOffset(RecordTable.java:212)
at js.tinyvm.Binary.initOffsets(Binary.java:736)
at js.tinyvm.Binary.createFromClosureOf(Binary.java:327)
at js.tinyvm.TinyVMTool.link(TinyVMTool.java:98)
at js.tinyvm.TinyVMTool.link(TinyVMTool.java:49)
at lejos.pc.tools.NXJLink.start(NXJLink.java:134)
at lejos.pc.tools.NXJLink.run(NXJLink.java:101)
at lejos.pc.tools.NXJLink.start(NXJLink.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
at lejos.pc.tools.NXJLink.main(NXJLink.java:28)
Linking the file failed with exit status 1

So, this means my binary *.nxj is not allowed to exceed 64 KB ?

Is this a 16 bit limitation of TinyVM or of LeJOS/NXT? Sounds like TinyVM... since it's not reaching uploading :(

Does anyone have some hints what can be done to reduce the memory usage, e. g. stripping unnecessary data from binary. However, from what I've understood so far it is already quite optimized? So the only real option seems for me to reduce my code somehow.

By the way, how can I check the available RAM during execution? I haven't figured out that so far, maybe I missed a method in the LeJOS API.
LEJOS 0.9.0 shows under "System" quite varying values for "free RAM". I assume it's the remaining RAM under the LeJOS menu system since sometimes it's raising again (gc?). What's the amount of free RAM in bytes for self-written programs? I also had problems with low RAM in the past...

Correct me please, but the whole binary is not loaded into the NXT RAM? It remains in the 256 KB flash memory as a file, just heap and stack are used from RAM, of course, right?

Thanks for every help!
nefast
New User
 
Posts: 2
Joined: Wed Oct 12, 2011 1:08 pm

Re: memory limit at 64 KB ?

Postby gloomyandy » Wed Oct 12, 2011 1:43 pm

Hi,
Yes the program is executed from the flash memory. However many of the internal tables use 16 bit offsets to limit memory usage, so you may have a hit a problem with one of those. It is however unusual to hit these limits, so this may be a problem with the linker. What does your code look like? If you want to send me a zip file of your code I will try and work out what is going on... If you want to do this send me a message via the message system used by this forum and I will sort out the details of getting hold of the zip file...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3646
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: memory limit at 64 KB ?

Postby nefast » Thu Oct 13, 2011 8:23 am

Thanks for your reply.
Well, after removing access to the RConsole components I managed to reduce the needed memory amount by precious ~9 KB. I personally think that I was a bit to eager regarding to the whole project since it surpassed 7000 lines of code now. Therefore it's a bit too much for a glimpse?
Besides, I am not sure if I can give my code to you since it's part of an important project for me at my university and permission is probably required for that step at first.

The verbose linker output gives this summary at the moment:
Master record : 20 bytes.
Class records : 241 (2892 bytes).
Field records : 345 (348 bytes).
Static fields : 180 (360 bytes).
Static state : 180 (724 bytes).
Constant records : 361 (1444 bytes).
Constant values : 361 (4520 bytes).
Method records : 995 (11940 bytes).
Exception records: 148 (1184 bytes).
Interface maps : 31 (44 bytes).
Code : 917 (37716 bytes).
Total : 60472 bytes.
Run time options : EnableCompact
Constant loads : 270N 119O 6W 264S
Static load/store: 69N 586O
Field load/store: 513N 1299O
nefast
New User
 
Posts: 2
Joined: Wed Oct 12, 2011 1:08 pm

Re: memory limit at 64 KB ?

Postby gloomyandy » Thu Oct 13, 2011 9:39 am

Hi,
well it is up to you... If you want my help you need to make it easy for me to help you... I've no interest in your actual code, just the impact it is having on the leJOS linker, I won't be publishing it on the internet... At a push you could just send me the class files I suppose...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3646
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff