Memory allocation: Difference between revisions
Content added Content deleted
Line 773: | Line 773: | ||
All memory in Oforth is managed by the garbage collector. Objects are all allocated on the heap using new on a class. |
All memory in Oforth is managed by the garbage collector. Objects are all allocated on the heap using new on a class. |
||
Stack can't be accessed and objects are never allocated on the stack. |
Stack can't be accessed and objects are never allocated on the stack : the stack holds only references to objects stored into local variables or parameters. |
||
The data stack holds only references to objects allocated on the heap. |
|||
You can allocate a block of memory (on the heap) by creating a MemBuffer object, which is an array of bytes. |
You can allocate a block of memory (on the heap) by creating a MemBuffer object, which is an array of bytes. |