IP Library Granted Patent US 10,599,564
Granted Patent B2
US 10,599,564 · App. 15/896,962 · Granted Mar 24, 2020

Resource reclamation method and apparatus

Inventors: Yumin Qi (Salinas, CA); Sanhong Li (Hangzhou, CN); Chuansheng Lu (Hangzhou, CN); Jianho Mo (Hangzhou, CN); Tongbao Zhang (Hangzhou, CN)
Assignee: ALIBABA GROUP HOLDING LIMITED
G06F12/0276G06F12/0284G06F9/45504G06F9/5016G06F9/5022G06F12/023G06F2212/1024
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 10,599,564
App. No.
15/896,962
Granted
Mar 24, 2020
Kind
B2
Abstract

Embodiments of the application provide a resource reclamation method and a resource reclamation apparatus. The method includes: determining a memory region corresponding to a target tenant included by a heap memory as a target region; and performing resource reclamation on the target region to release the target region.

Claims (70)

1. A resource reclamation method, comprising:

determining a memory region corresponding to a target tenant included by a heap memory as a target region comprising:

determining a memory region, in a first memory region for storing young generation objects in the heap memory, corresponding to a first target tenant included in the target tenant as a first target region, wherein the first target region comprises a new generation object region and a first survivor region, the heap memory further includes at least one other memory region corresponding to at least one other service tenant configured for processing at least one service request, and there is no reference relationship between the target tenant and the at least one other service tenant; and

performing resource reclamation on the target region to release the target region comprising:

determining first available objects in the first target region,

removing the determined first available objects from the new generation object region and the first survivor region of the first target region,

updating reference addresses in a root tenant region for the first available objects, and

releasing the new generation object region and the first survivor region in the first target region,

wherein the resource reclamation on the target region is performed while the at least one service request by the at least one other service tenant is processed and a process of a service request by the target tenant is suspended.

2. The method according to claim 1 , wherein the at least one other service tenant share a static variable with the target tenant, and the method further comprises:

determining, in response to the static variable being stored in the heap memory, whether the static variable can be isolated between the at least one other service tenant and the target tenant; and

in response to the determination that the static variable can be isolated between the at least one other service tenant and the target tenant, storing a copy of the static variable in each service tenant region of the at least one other service tenant and the target tenant.

3. The method according to claim 2 , further comprising:

in response to the determination that the static variable cannot be isolated between the at least one other service tenant and the target tenant, storing the static variable in the root tenant region of the heap memory, wherein

the root tenant region stores objects of a root tenant, and the root tenant provides the at least one other service tenant and the target tenant with resources for running.

4. The method according to claim 1 , wherein

the first target tenant is determined according to space occupancy ranking, the space occupancy ranking being obtained by sorting service tenants according to a descending order of storage spaces occupied by the service tenants in the first memory region; or

the first target tenant is determined according to sizes of the storage spaces currently occupied by service tenants in the first memory region; or

the first target tenant is determined according to a preset tenant reclamation order, the preset tenant reclamation order being a preset sequence for performing a resource reclamation operation on the regions, in the first memory region, corresponding to the service tenants.

5. The method according to claim 1 , wherein determining first available objects in the first target region further comprises:

determining a root object corresponding to the first target tenant; and

determining objects, in the first target region, referred by the root object as the first available objects.

6. The method according to claim 5 , wherein the heap memory further comprises a second memory region for storing old generation objects; and

after releasing the new generation object region and the first survivor region in the first target region, the method further comprises:

marking the tenant memory region corresponding to a second target tenant, the second target tenant being a service tenant having occupied storage space in the second memory region meeting a preset concurrent marking condition.

7. The method according to claim 6 , wherein marking the tenant memory region corresponding to the second target tenant further comprises:

determining, according to a root object corresponding to the second target tenant, second available objects in the service tenant region corresponding to the second target tenant;

determining third available objects referring the second available objects; and

determining fourth available objects according to the second available objects, the third available objects, and a change in an object reference relationship of the second target tenant in the process of determining the third available objects.

8. The method according to claim 7 , wherein determining the memory region corresponding to the target tenant in the heap memory as the target region further comprises:

determining a target memory region in each memory region corresponding to the second target tenant as a second target region, the target memory region being a memory region, in the service tenant region, where the stored fourth available objects meet a preset storage condition; and

performing resource reclamation on the target region further comprises:

determining available objects in the second target region as fifth available objects;

removing the fifth available objects out of the second target region;

updating reference addresses in the root tenant region for the fifth available objects; and

releasing the second target region.

9. The method according to claim 8 , further comprising:

performing resource reclamation on the heap memory in response to a memory fragmentation degree of the root tenant region exceeding a fragmentation threshold.

10. A resource reclamation apparatus, comprising:

a memory storing a set of instructions; and

one or more processors configured to execute the set of instructions to cause the apparatus to:

determine a memory region corresponding to a target tenant in a heap memory as a target region comprising:

determine a memory region, in a first memory region for storing young generation objects in the heap memory, corresponding to a first target tenant included in the target tenant as a first target region, wherein the first target region comprises a new generation object region and a first survivor region, the heap memory further includes at least one other memory region corresponding to at least one other service tenant configured for processing at least one service request, and there is no reference relationship between the target tenant and the at least one other service tenant; and

perform resource reclamation on the target region to release the target region comprising:

determine first available objects in the first target region,

remove the determined first available objects from the new generation object region and the first survivor region of the first target region,

update reference addresses in a root tenant region for the first available objects, and

release the new generation object region and the first survivor region in the first target region,

wherein the resource reclamation on the target region is performed while the at least one service request by the at least one other service tenant is processed and a process of a service request by the target tenant is suspended.

11. The apparatus according to claim 10 , wherein the at least one service tenant shares a static variable with the target tenant, and the one or more processors are configured to execute the set of instructions to cause the apparatus to further:

determine, in response to the static variable being stored in the heap memory, whether the static variable can be isolated between the at least one service tenant and the target tenant; and

store a copy of the static variable in each service tenant region of the at least one service tenant and the target tenant in response to the determination that the static variable can be isolated between the at least one service tenant and the target tenant.

12. The apparatus according to claim 11 , wherein the one or more processors are configured to execute the set of instructions to cause the apparatus to further:

store the static variable in the root tenant region of the heap memory in response to the determination that the static variable cannot be isolated between the at least one service tenant and the target tenant, wherein

the root tenant region stores objects of a root tenant, and the root tenant provides the service tenants with resources for running.

13. A non-transitory computer readable medium that stores a set of instructions that is executable by at least one processor of an electronic device to cause the device to perform a resource reclamation method, the method comprising:

determining a memory region corresponding to a target tenant included by a heap memory as a target region comprising:

determining a memory region, in a first memory region for storing young generation objects in the heap memory, corresponding to a first target tenant included in the target tenant as a first target region, wherein the first target region comprises a new generation object region and a first survivor region, the heap memory further includes at least one other memory region corresponding to at least one other service tenant configured for processing at least one service request, and there is no reference relationship between the target tenant and the at least one other service tenant; and

performing resource reclamation on the target region to release the target regioncomprising:

determining first available objects in the first target region,

removing the determined first available objects from the new generation object region and the first survivor region of the first target region,

updating reference addresses in a root tenant region for the first available objects, and

releasing the new generation object region and the first survivor region in the first target region,

wherein the resource reclamation on the target region is performed while the at least one service request by the at least one other service tenant is processed and a process of a service request by the target tenant is suspended.

14. The non-transitory computer readable medium according to claim 13 , wherein the at least one other service tenant share a static variable with the target tenant, and the set of instructions is executable by the at least one processor of the device to cause the device to further perform:

determining, in response to the static variable being stored in the heap memory, whether the static variable can be isolated between the at least one other service tenant and the target tenant; and

in response to the determination that the static variable can be isolated between the at least one other service tenant and the target tenant, storing a copy of the static variable in each service tenant region of the at least one other service tenant and the target tenant.

15. The non-transitory computer readable medium according to claim 14 , wherein the set of instructions is executable by the at least one processor of the device to cause the device to further perform:

in response to the determination that the static variable cannot be isolated between the at least one other service tenant and the target tenant, storing the static variable in the root tenant region of the heap memory, wherein

the root tenant region stores objects of a root tenant, and the root tenant provides the at least one other service tenant and the target tenant with resources for running.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 29, 2026
From: ALIBABA GROUP HOLDING LIMITED
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075499/0384 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 28, 2020
From: QI, YUMIN; LI, SANHONG; LU, CHUANSHENG; MO, JIANHAO; ZHANG, TONGBAO
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 051640/0796 →
Priority Claims (1)
CN 2017 1 0090482 · Feb 20, 2017 · national
Continuity (1)
Related Publication 20180239699A1 · Aug 23, 2018