Claims
- 1. A method of executing a method to enable memory associated with objects not referenced external to the executed method to be reclaimed upon completion of execution of the executed method, comprising:
obtaining a data structure including one or more addresses of source code that creates local objects; obtaining next source code in the method; determining whether an address of the obtained next source code is in the data structure; and when the address of the obtained next source code is in the data structure including one or more addresses of source code that creates local objects, creating a local object on a local heap of memory using the source code associated with the address such that local objects are stored in memory separately from non-local objects.
- 2. The method as recited in claim 1, wherein determining whether the address of the source code is in the data structure comprises:
determining whether a program counter of the source code is in the data structure.
- 3. The method as recited in claim 1, further comprising:
when the address of the source code is in the data structure, reclaiming memory associated with the local heap upon termination of execution of the method.
- 4. The method as recited in claim 1, further comprising:
when the address of the source code is in the data structure, returning memory associated with the local heap to a pool of available memory upon termination of execution of the method.
- 5. The method as recited in claim 1, further comprising:
creating a dynamic structure adapted for storing dynamic information related to method execution; and associating the local heap with the dynamic structure.
- 6. The method as recited in claim 5, wherein associating the local heap with the dynamic structure comprises extending a pointer from the dynamic structure to the local heap.
- 7. The method as recited in claim 5, wherein the dynamic structure is a Java frame.
- 8. The method as recited in claim 7, wherein the Java frame is a data structure in a Java interpreter.
- 9. The method as recited in claim 8, further comprising:
removing the Java frame from memory when execution of the method terminates.
- 10. The method as recited in claim 1, further comprising:
allocating a free chunk of available memory as the local heap for storage of one or more local objects.
- 11. The method as recited in claim 1, wherein the local heap comprises one or more chunks of memory, wherein creating a local object on a local heap of memory using the source code comprises:
determining whether the local heap contains available memory for storage of the local object; when the local heap contains available memory sufficient for storage of the local object, creating the local object in one of the chunks of memory; when the local heap does not contain available memory sufficient for storage of the local object, allocating a new chunk, associating the new chunk with the local heap, and storing the local object in the new chunk.
- 12. The method as recited in claim 11, wherein associating the new chunk with the local heap comprises providing a pointer to the new chunk such that the local heap is composed of a linked list of memory chunks.
- 13. The method as recited in claim 1, wherein obtaining a data structure including one or more addresses of source code that creates local objects comprises:
obtaining an attribute_info structure from a Java class file.
- 14. The method as recited in claim 1, wherein the source code comprises bytecodes.
- 15. The method as recited in claim 8, wherein the bytecodes are Java bytecodes.
- 16. A computer-readable medium for executing a method to enable memory associated with objects not referenced external to the executed method to be reclaimed upon completion of execution of the executed method, comprising:
instructions for obtaining a data structure including one or more addresses of source code that creates local objects; instructions for determining whether an address of the obtained next source code is in the data structure; and instructions for when the address of the obtained next source code is in the data structure including one or more addresses of source code that creates local objects, creating a local object on a local heap of memory using the source code associated with the address such that local objects are stored in memory separately from non-local objects.
- 17. An apparatus for executing a method to enable memory associated with objects not referenced external to the executed method to be reclaimed upon completion of execution of the executed method, comprising:
means for obtaining a data structure including one or more addresses of source code that creates local objects; means for obtaining next source code in the method; means for determining whether an address of the obtained next source code is in the data structure; and means for when the address of the obtained next source code is in the data structure including one or more addresses of source code that creates local objects, creating a local object on a local heap of memory using the source code associated with the address such that local objects are stored in memory separately from non-local objects.
- 18. An apparatus for executing a method to enable memory associated with objects not referenced external to the executed method to be reclaimed upon completion of execution of the executed method, comprising:
a processor; and a memory, at least one of the processor and the memory being adapted for:
obtaining a data structure including one or more addresses of source code that creates local objects; obtaining next source code in the method; determining whether an address of the obtained next source code is in the data structure; and when the address of the obtained next source code is in the data structure including one or more addresses of source code that creates local objects, creating a local object on a local heap of memory using the source code associated with the address such that local objects are stored in memory separately from non-local objects.
CROSS REFERENCE TO RELATED APPLICATIONS
[0001] This invention is related to U.S. patent application Ser. No. ______ (attorney docket no. SUN1P286/P4991), filed on the same day, naming David Wallman as inventor, and entitled “METHODS AND APPARATUS FOR ENABLING LOCAL JAVA OBJECT ALLOCATION AND COLLECTION.” That application is incorporated herein by reference in its entirety and for all purposes.