This invention relates to memory management in a virtual machine or operating
system and in particular to object creation and garbage collection. There is described
a method and system of managing memory in a multi-threaded processing environment
such as a java virtual machine comprising: creating an object in a thread heap;
associating a status with the object and setting the status as local; using write
barriers to change the status to global if the object is assigned to a static variable
or if the object is assigned to a field in a global object; changing the status
of all objects referenced by that object to global; and performing garbage collection
by deleting from the thread heap, when memory space in the thread heap is required,
one or more local objects which can not be traced to the thread stack.