IP Library Granted Patent US 7,558,935
Granted Patent B1
US 7,558,935 · App. 10/838,603 · Granted Jul 7, 2009

Method and system for optimizing memory allocation

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 7,558,935
App. No.
10/838,603
Granted
Jul 7, 2009
Kind
B1
Abstract

Methods, systems, and articles of manufacture consistent with the present invention optimize allocation of items to a stack memory instead of a heap memory. It is determined whether an item to be placed on the heap memory escapes from the scope of the item's allocator, and whether the item survives the item's allocator. The item is allocated to the stack memory responsive to the item not escaping from the scope of the item's allocator and not surviving the item's allocator.

Claims (33)

1. A method in a data processing system for optimizing memory allocation to a stack memory instead of a heap memory, the method comprising the steps of:

determining whether an item to be placed on the heap memory escapes from the scope of the item's allocator;

determining whether the item survives the item's allocator; and

allocating the item to the stack memory responsive to the item not escaping from the scope of the item's allocator and not surviving the item's allocator,

wherein the item survives the item's allocator when a deallocator of the item does not postdominate the item's allocator and does not postdominate an allocator of a copy of a pointer to the item.

2. The method of claim 1 , wherein the step of allocating the item to the stack memory comprises replacing a heap memory instruction for allocating the item to the heap with a stack memory instruction for allocating the item to the stack.

3. The method of claim 1 , wherein the item to be placed on the heap memory escapes from the scope of the item's allocator when at least one of the item, a copy of the item, and a pointer to the item is copied to a global variable.

4. The method of claim 1 , wherein the item to be placed on the heap memory escapes from the scope of the item's allocator when at least one of the item, a copy of the item, and a pointer to the item is passed as an argument to a code section located outside of the item's allocator.

5. The method of claim 1 , wherein the item to be placed on the heap memory escapes from the scope of the item's allocator when at least one of the item, a copy of the item, and a pointer to the item is included as an argument upon exit of the item's allocator.

6. The method of claim 1 , wherein the method is performed in relation to compiling a source code.

7. The method of claim 1 , wherein the method is performed in relation to executing an object code.

8. A data processing system including a processor and memory which is configured to receive instructions from a computer-readable storage medium that cause a program running in the memory of the data processing system to perform a method for optimizing memory allocation to a stack memory instead of a heap memory, the method comprising the steps of:

determining whether an item to be placed on the heap memory escapes from the scope of the item's allocator;

determining whether the item survives the item's allocator; and

allocating the item to the stack memory responsive to the item not escaping from the scope of the item's allocator and not surviving the item's allocator,

wherein the item survives the item's allocator when a deallocator of the item does not postdominate the item's allocator and does not postdominate an allocator of a copy of a pointer to the item.

9. The data processing system of claim 8 , wherein the step of allocating the item to the stack memory comprises replacing a heap memory instruction for allocating the item to the heap with a stack memory instruction for allocating the item to the stack.

10. The data processing system of claim 8 , wherein the item to be placed on the heap memory escapes from the scope of the item's allocator when at least one of the item, a copy of the item, and a pointer to the item is copied to a global variable.

11. The data processing system of claim 8 , wherein the item to be placed on the heap memory escapes from the scope of the item's allocator when at least one of the item, a copy of the item, and a pointer to the item is passed as an argument to a code section located outside of the item's allocator.

12. The data processing system of claim 8 , wherein the item to be placed on the heap memory escapes from the scope of the item's allocator when at least one of the item, a copy of the item, and a pointer to the item is included as an argument upon exit of the item's allocator.

13. The data processing system of claim 8 , wherein the method is performed in relation to compiling a source code.

14. The data processing system of claim 8 , wherein the method is performed in relation to executing an object code.

15. A data processing system for optimizing memory allocation to a stack memory instead of a heap memory, the data processing system comprising:

a memory having a program that determines whether an item to be placed on the heap memory escapes from the scope of the item's allocator, determines whether the item survives the item's allocator, and allocates the item to the stack memory responsive to the item not escaping from the scope of the item's allocator and not surviving the item's allocator; and

a processing unit that runs the program,

wherein the item survives the item's allocator when a deallocator of the item does not postdominate the item's allocator and does not postdominate an allocator of a copy of a pointer to the item.

16. The data processing system of claim 15 , wherein the item is allocated to the stack memory in relation to compiling a source code.

17. The data processing system of claim 15 , wherein the item is allocated to the stack memory in relation to executing an object code.

18. A data processing system for optimizing memory allocation to a stack memory instead of a heap memory, the data processing system comprising:

means for determining whether an item to be placed on the heap memory escapes from the scope of the item's allocator;

means for determining whether the item survives the item's allocator; and

means for allocating the item to the stack memory responsive to the item not escaping from the scope of the item's allocator and not surviving the item's allocator,

wherein the item survives the item's allocator when a deallocator of the item does not postdominate the item's allocator and does not postdominate an allocator of a copy of a pointer to the item.

Assignments (2)
MERGER AND CHANGE OF NAME Recorded Dec 16, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037304/0183 →
CORRECTED ASSIGNMENT COVER Recorded Nov 29, 2004
From: BOUCHER, MICHAEL L.; CROWL, LAWRENCE A.; MILLER, TERRENCE C.
To: SUN MICROSYSTEMS, INC.
Reel/Frame 016025/0789 →