A built-in function tried to access memory outside the Heap or Screen range.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

A built-in function tried to access memory outside the Heap or Screen range.

manikishan
I am testing my Keyboard.jack, while the main function accesses string length and int value, I am getting this error in VM emulator. Is it a bug in Emulator or error in my Keyboard class?
Reply | Threaded
Open this post in threaded view
|

Re: A built-in function tried to access memory outside the Heap or Screen range.

ivant
Even though it's a built-in function has tried to do that, chances are that your code has called it with bad arguments. If you can't find the problem, you can email me the code and I'll take a look.
Reply | Threaded
Open this post in threaded view
|

Re: A built-in function tried to access memory outside the Heap or Screen range.

manikishan
This post was updated on .
Thank you for replying, I sent a email to you my Keyboard class and the
test main class please check through. Thanks for helping me :)
Reply | Threaded
Open this post in threaded view
|

Re: A built-in function tried to access memory outside the Heap or Screen range.

manikishan




Keyboard.jack (3K) Download Attachment
Main.jack (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: A built-in function tried to access memory outside the Heap or Screen range.

manikishan
In reply to this post by ivant


On Tue, 25 Dec 2018 at 20:56, Manikishan Ghantasala <[hidden email]> wrote:




Main.jack (3K) Download Attachment
Keyboard.jack (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: A built-in function tried to access memory outside the Heap or Screen range.

ivant
The only problem I found was that the sources didn't compile right away, because readLine is supposed to return string, while yours didn't return anything. I just change the line to "return str;" and it compiled without problem.

I then run the main class and it worked without problems. Most probably you have some bug in one of your other OS classes. The best way to test them one by one, while using the provided OS classes for support. For example, create a new directory, put your compiled Keyboard.vm class and the test KeyboardTest/Main.vm class and run it. This way the other OS classes will be the one provided with the project. Repeat this for all classes until you make sure they are working fine.

Another thing to try is to use the directory where you can reproduce the problem. Start by moving one OS .vm out of it and test it to see if you still get the exception. If you do, return the .vm file and move the next one. Repeat until you pinned the bad class.

Use the breakpoint and stepping facilities of the VMEmulator to try to find the problem.

P.S. After you're done, please remove your sources from the post.
Reply | Threaded
Open this post in threaded view
|

Re: A built-in function tried to access memory outside the Heap or Screen range.

manikishan
Sorry for the late reply, I changed the "return" to "return str" that worked, Thanks,