US2020174922A1PendingUtilityA1
Resource reclamation method and apparatus
Est. expiryFeb 20, 2037(~10.6 yrs left)· nominal 20-yr term from priority
G06F 9/45504G06F 12/0284G06F 12/0276G06F 2212/1024G06F 9/5022G06F 9/5016G06F 12/023G06F 9/45558G06F 2009/45583
44
PatentIndex Score
0
Cited by
0
References
0
Claims
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
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A resource reclamation method, comprising:
determining a memory region corresponding to a target tenant included by a heap memory as a target region, wherein 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 the at least one other service tenant share a static variable with the target tenant; determining whether the static variable can be isolated between the at least one other service tenant and the target tenant; 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; and performing resource reclamation on the target region to release the 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 of claim 1 , 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 a 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.
3 . The method of claim 1 , wherein the target tenant includes a first target tenant, and
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 a first memory region for storing young generation objects in the heap memory; 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.
4 . The method of claim 3 , wherein determining the memory region corresponding to the target tenant in the heap memory as the target region further comprises:
determining a memory region, in the first memory region, corresponding to the first target tenant as a first target region, the first target region comprising a new generation object region and a first survivor region; and wherein performing resource reclamation on the target region to release the target region further comprises: 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 the 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.
5 . The method of claim 4 , 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 of 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 of 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 of 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 of 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 perform:
determining a memory region corresponding to a target tenant included by a heap memory as a target region, wherein 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 the at least one other service tenant share a static variable with the target tenant;
determining 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; and
performing resource reclamation on the target region to release the 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 of claim 10 , wherein the one or more processors are configured to execute the set of instructions to cause the apparatus to further perform:
storing the static variable in a 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.
12 . The apparatus of claim 10 , wherein the target tenant includes a first target tenant, and
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 a first memory region for storing young generation objects in the heap memory; 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.
13 . The apparatus of claim 12 , wherein determining the memory region corresponding to the target tenant in the heap memory as the target region further comprises:
determining a memory region, in the first memory region, corresponding to the first target tenant as a first target region, the first target region comprising a new generation object region and a first survivor region; and wherein performing resource reclamation on the target region to release the target region further comprises: 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 the 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.
14 . The apparatus of claim 13 , 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.
15 . The apparatus of claim 14 , 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 one or more processors are configured to execute the set of instructions to cause the apparatus to further perform: 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.
16 . The apparatus of claim 15 , 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.
17 . The apparatus of claim 16 , 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.
18 . The apparatus of claim 17 , wherein the one or more processors are configured to execute the set of instructions to cause the apparatus to further perform:
performing resource reclamation on the heap memory in response to a memory fragmentation degree of the root tenant region exceeding a fragmentation threshold.
19 . 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, wherein 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 the at least one other service tenant share a static variable with the target tenant; determining 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; and performing resource reclamation on the target region to release the 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.
20 . The non-transitory computer readable medium according to claim 19 , 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 a 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.Join the waitlist — get patent alerts
Track US2020174922A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.