Closed happytomatoe closed 2 months ago
@happytomatoe Thank you for opening this issue.
Is this expected
I'm going to say that it looks like you're stress testing the NAND2Tetris system beyond what we've done at this point! Well done! :)
Jack as a language is designed as a teaching language, not a memory safe high performance language. Reading this code, you create an array with 8000 elements (that is, allocate 8000 pointers), then attempt to create 8000 instances of a class with one field, so you have 1x Memory.alloc(8000) + 8000x Memory.alloc(1). The default memory allocator IIRC uses a naive linked list to track fee segments, so there's an additional "byte" per alloc, for an expected total allocation in this program of 24,001, however, HEAP_SIZE in the Hack VM is 14,336 items.
So, yes, this is "expected behavior".
Tool
VM Emulator
Interface
Website (https://nand2tetris.github.io/web-ide)
Contact Details
No response
What happened?
Hi! When I try to run next code at maximum speed I get
Program exited with error code 6: Heap overflow (Memory.alloc)
. Is this expected? When I allocate/dispone Array with ints everything works.Additional Comments
No response
Do you want to try to fix this bug?
Code of Conduct