|
Following the suggestion from the book of using a LinkedList for the improved memory allocation algorithm, the way I envisioned the implementation would be to implement our own LinkedList.jack and Node.jack class and create instances of these objects in the Memory.jack class.
However, if these objects were instantiated in Memory class, they would be stored on the heap right? And wouldn't that interfere with the Memory class heap management operations? For instance, the heap occupies RAM addresses 2048 - 16383. If LinkedList and Node objects were created, they would take up some of these addresses. Could that cause issues for the Memory class and alloc() function in terms of keeping track which addresses are taken and which are not?
It also seems that this approach would cause some recursive/circular definition of the alloc() function since you're trying to implement alloc(), but in the implementation you will make a call to alloc() again since you'd have to allocate space for LinkedList and Node(s).
Are these issues something I should worry about?
|