Patent ID: 8572130

Claim:
A method implemented on a machine having at least one processor for a database system, comprising: creating a first resource queue indicating an order of resources stored in a memory, the order based on respective timestamps associated with the stored resources; associating the first resource queue with a first queue timestamp; receiving a first command to deallocate a first amount of stored resources from the memory; determining that a first stored resource indicated by the first resource queue is associated with a timestamp earlier than the first queue timestamp; deallocating the first stored resource from the memory; receiving a second command to deallocate a second amount of stored resources from the memory; determining that the first resource queue indicates no stored resources which are associated with a timestamp earlier than the first queue timestamp; in response to the determination that the first resource queue indicates no stored resources which are associated with a timestamp earlier than the first queue timestamp, creating a second resource queue indicating a second order of second resources stored in the memory, the second order based on respective second timestamps associated with the stored second resources; creating a third resource queue indicating a third order of resources of a second disposition type stored in the memory, the third order based on respective timestamps associated with the stored resources of the second disposition type; and associating the third resource queue with a third queue timestamp; wherein determining that the first stored resource indicated by the first resource queue is associated with a timestamp earlier than the first queue timestamp comprises: determining a first not-in-use time for a stored resource indicated by the first resource queue based on a first timestamp associated with the stored resource; determining a first weighted not-in-use time for the stored resource based on the first not-in-use time and on a first weight associated with the first disposition type; determining a second not-in-use time for a stored resource indicated by the first resource queue based on a first timestamp associated with the stored resource; determining a second weighted not-in-use time for the stored second resource based on the second not-in-use time and on a second weight associated with the second disposition type; and determining that the first weighted not-in-use time is greater than the second weighted not-in-use time.