Patent ID: 8185880

Claim:
A computer implemented method for optimizing usage of heap memory, the method comprising inserting additional program code instructions at predefined locations into existing program code of a computer program, the additional instructions configured to search a header of a heap memory block to identify, data associated with lag and drag lifetimes of the heap memory block; executing the computer program with the inserted additional program code; creating during execution of the computer program a header for a heap memory block allocated in heap memory, collecting runtime data comprising timestamps associated with lag and drag lifetimes of the heap memory and storing the runtime data in the header of the heap memory block; identifying subsequent to the execution of the computer program from the collected runtime data the lag and drag lifetimes associated with the heap memory block; creating a bit map table comprising two bits for all allocated heap memory; wherein for every use of the heap memory: if a first use bit in the bit map table is not set, searching for the header of the corresponding heap memory block and recording the current timestamp as the first use timestamp; updating the first use bit for all addresses associated with that heap memory block in the bit map table for that memory as 1; and setting a last use bit in the table for that memory to 1.