[go: up one dir, main page]

CN106293939A - A kind of method of dynamic reuse object in internal memory garbage collector - Google Patents

A kind of method of dynamic reuse object in internal memory garbage collector Download PDF

Info

Publication number
CN106293939A
CN106293939A CN201610638602.9A CN201610638602A CN106293939A CN 106293939 A CN106293939 A CN 106293939A CN 201610638602 A CN201610638602 A CN 201610638602A CN 106293939 A CN106293939 A CN 106293939A
Authority
CN
China
Prior art keywords
stack
memory block
cache
objects
garbage collector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610638602.9A
Other languages
Chinese (zh)
Other versions
CN106293939B (en
Inventor
王斐
史晓华
李超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beihang University
Original Assignee
Beihang University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beihang University filed Critical Beihang University
Priority to CN201610638602.9A priority Critical patent/CN106293939B/en
Publication of CN106293939A publication Critical patent/CN106293939A/en
Application granted granted Critical
Publication of CN106293939B publication Critical patent/CN106293939B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

本发明提供了一种在内存垃圾收集器中动态重用对象的方法,用于Java虚拟机中。本方法对重用价值比较高的对象设置缓存空间,为对应的类设置对象缓存栈,保存垃圾收集器放入的对应类的死亡对象的地址。在分配重用对象时,根据重用对象的类的元数据找到对应的对象缓存栈,若对象缓存栈不为空,从对象缓存栈中分配缓存的同类型死亡对象,若对象缓存栈为空,从缓存空间中分配对象。本发明在分配重用对象死亡之后记录死亡对象的地址,在分配同类型的对象时,直接重用那些死亡对象的空间。本发明能减少垃圾收集器分配对象的负载,加快分配对象的速度,减少垃圾回收的发生次数和内存上的管理开销,提高内存的使用效率和虚拟机的整体性能。

The invention provides a method for dynamically reusing objects in a memory garbage collector, which is used in a Java virtual machine. This method sets the cache space for objects with relatively high reuse value, sets the object cache stack for the corresponding class, and saves the address of the dead object of the corresponding class put by the garbage collector. When allocating reused objects, find the corresponding object cache stack according to the metadata of the class of the reused object. If the object cache stack is not empty, allocate the cached dead object of the same type from the object cache stack. If the object cache stack is empty, start from Objects are allocated in cache space. The present invention records the addresses of dead objects after allocating reused objects, and directly reuses the space of those dead objects when allocating objects of the same type. The invention can reduce the load of the object allocated by the garbage collector, accelerate the object allocation speed, reduce the occurrence times of garbage collection and the management overhead on the memory, and improve the use efficiency of the memory and the overall performance of the virtual machine.

Description

一种在内存垃圾收集器中动态重用对象的方法A Method for Dynamically Reusing Objects in Memory Garbage Collector

技术领域technical field

本发明属于计算机应用技术领域,具体是一种在内存垃圾收集器中动态重用对象的方法。The invention belongs to the field of computer application technology, in particular to a method for dynamically reusing objects in a memory garbage collector.

背景技术Background technique

目前许多编程语言如Java、C#、Python和PHP等,都支持垃圾收集(GarbageCollectoion,GC),用于回收无用内存,其中尤以Java虚拟机为代表。垃圾收集器帮助程序员自动回收无用的内存,避免了许多传统编程语言中易发生的内存错误,但垃圾收集器需要占用程序的运行时间,找出死亡的对象,然后回收利用,这对于频繁分配对象的程序非常不利,同时也增加了垃圾收集器的内存管理开销(时间和空间),因为需要频繁的停止程序以便回收内存。At present, many programming languages such as Java, C#, Python, and PHP support garbage collection (GarbageCollectoion, GC), which is used to reclaim useless memory, especially represented by the Java virtual machine. The garbage collector helps programmers to automatically reclaim useless memory, avoiding memory errors that are prone to occur in many traditional programming languages, but the garbage collector needs to occupy the running time of the program to find dead objects and then recycle them, which is very important for frequent allocation. The program of the object is very disadvantageous, and it also increases the memory management overhead (time and space) of the garbage collector, because the program needs to be stopped frequently to reclaim memory.

发明内容Contents of the invention

本发明针对上述问题,提出一种创新的动态重用Java对象的方法,可以高效的重用那些分配数量大同时生命周期很短的对象,避免垃圾收集器对这些对象进行回收,从而减少垃圾回收的发生次数和内存上的管理开销,提高内存的使用效率和虚拟机的整体性能。In view of the above problems, the present invention proposes an innovative method for dynamically reusing Java objects, which can efficiently reuse those objects with a large number of allocations and a short life cycle, and avoid garbage collectors from reclaiming these objects, thereby reducing the occurrence of garbage collection The number of times and memory management overhead, improve the efficiency of memory usage and the overall performance of the virtual machine.

本发明提供的一种在内存垃圾收集器中动态重用对象的方法,通过如下方面实现:A method for dynamically reusing objects in a memory garbage collector provided by the present invention is realized through the following aspects:

(1)设置缓存空间的组织方式;缓存空间将内存块用一个链表组织起来。缓存空间的元数据包含两个字段:cur_chunk和lock;cur_chunk指向链表的头结点,lock用于同步线程对同一个缓存空间的访问。内存块用于分配对象,每个内存块的起始部分存放内存块的元数据,包含三个字段:size、free_ptr和next_chunk。字段size中存储内存块的总大小,free_ptr为空闲指针,表示下一次在该内存块中分配对象时的起始位置,next_chunk为指向下一个内存块的指针。缓存空间中的内存块从不释放,直到虚拟机被销毁时才返还给操作系统。(1) Set the organization mode of the cache space; the cache space organizes memory blocks with a linked list. The metadata of the cache space contains two fields: cur_chunk and lock; cur_chunk points to the head node of the linked list, and lock is used to synchronize the access of threads to the same cache space. Memory blocks are used to allocate objects, and the beginning of each memory block stores the metadata of the memory block, including three fields: size, free_ptr, and next_chunk. The field size stores the total size of the memory block, free_ptr is a free pointer, indicating the starting position of the next allocation of objects in this memory block, and next_chunk is a pointer to the next memory block. Memory blocks in the cache space are never freed and are not returned to the operating system until the virtual machine is destroyed.

(2)为选择的重用价值高的类设置对象缓存栈,在类的元数据中存放指向对象缓存栈的指针,对象缓存栈中保存了垃圾收集器放入的对应类的死亡对象的地址。(2) Set the object cache stack for the selected class with high reuse value, store the pointer to the object cache stack in the metadata of the class, and store the address of the dead object of the corresponding class put into the garbage collector in the object cache stack.

(3)在分配重用对象时,根据重用对象的类的元数据找到对应的对象缓存栈,若对象缓存栈不为空,从对象缓存栈中分配缓存的同类型死亡对象,若对象缓存栈为空,从缓存空间中分配对象。(3) When allocating reused objects, find the corresponding object cache stack according to the metadata of the class of the reused object. If the object cache stack is not empty, allocate the cached dead objects of the same type from the object cache stack. If the object cache stack is Empty, the object is allocated from the cache space.

本发明的优点与积极效果在于:本方法对那些重用价值比较高的对象设置缓存空间,在这些对象死亡之后记录死亡对象的地址。在分配同类型的对象时,直接重用那些死亡对象的空间。本方法能减少垃圾收集器分配对象的负载,加快分配对象的速度,减少垃圾回收的发生次数和内存上的管理开销,提高内存的使用效率和虚拟机的整体性能。The advantages and positive effects of the present invention are: the method sets cache space for those objects with relatively high reuse value, and records the addresses of the dead objects after these objects die. When allocating objects of the same type, the space of those dead objects is directly reused. The method can reduce the object allocation load of the garbage collector, accelerate the object allocation speed, reduce the occurrence times of garbage collection and memory management overhead, and improve the memory usage efficiency and the overall performance of the virtual machine.

附图说明Description of drawings

图1是垃圾回收发生之前的对象引用状态示意图;Figure 1 is a schematic diagram of the object reference state before garbage collection occurs;

图2是垃圾收集器对存活对象进行标记的示意图;Figure 2 is a schematic diagram of the garbage collector marking the surviving objects;

图3是对死亡对象进行回收阶段的示意图;Fig. 3 is a schematic diagram of the stage of recycling dead objects;

图4是分配一个A类型的对象之后的示意图;Figure 4 is a schematic diagram after allocating an object of type A;

图5是本发明所使用的缓存空间的组织结构示意图;Fig. 5 is a schematic diagram of the organizational structure of the cache space used by the present invention;

图6是类的元数据及其对象缓存栈;Figure 6 is the metadata of the class and its object cache stack;

图7是正常对象分配流程与优化后的分配流程;Figure 7 shows the normal object allocation process and the optimized allocation process;

图8是分别从缓存栈和缓存空间分配对象的流程。FIG. 8 is a process of allocating objects from the cache stack and the cache space respectively.

具体实施方式detailed description

下面将结合附图和实施例对本发明作进一步的详细说明。The present invention will be further described in detail with reference to the accompanying drawings and embodiments.

如图1所示,为对象在GC(Garbage Collection)堆和缓存空间中的分布。对象之间的引用关系用箭头表示,箭头端表示被引用的对象,虚线箭头表示箭头两端的对象不在同一个区域,即一个在GC堆,一个在缓存空间中,所有存活对象可由根集到达。垃圾收集器不会对缓存空间进行回收,其中的内存将按照本发明方法进行高效使用。缓存空间的组织结构如图5所示。As shown in Figure 1, it is the distribution of objects in the GC (Garbage Collection) heap and cache space. The reference relationship between objects is represented by arrows. The arrow end represents the referenced object. The dotted arrow indicates that the objects at both ends of the arrow are not in the same area, that is, one is in the GC heap and the other is in the cache space. All surviving objects can be reached by the root set. The garbage collector will not reclaim the cache space, and the memory therein will be efficiently used according to the method of the present invention. The organizational structure of the cache space is shown in Figure 5.

如图2所示,是垃圾收集器的标记阶段。图的上部为标记前对象的分布情况,图的下部为标记后对象的分布情况,所有不可由根集到达的对象都被标记为死亡对象。该阶段标识出了所有存活对象,死亡对象与存活对象之间不再有任何引用关系。As shown in Figure 2, it is the marking phase of the garbage collector. The upper part of the figure is the distribution of objects before marking, and the lower part of the figure is the distribution of objects after marking. All objects that cannot be reached by the root set are marked as dead objects. This stage identifies all surviving objects, and there is no longer any reference relationship between dead objects and surviving objects.

如图3所示,是回收死亡对象的阶段。在该阶段中,若一个死亡对象属于GC堆,则由垃圾收集器按照正常流程处理,若一个死亡对象属于缓存空间,利用本发明方法,将该对象放入它所属class类型的对象缓存栈中,对象缓存栈如图6所示。As shown in Figure 3, it is the stage of recycling dead objects. In this stage, if a dead object belongs to the GC heap, it will be processed by the garbage collector according to the normal process; if a dead object belongs to the cache space, the method of the present invention is used to put the object into the object cache stack of the class type to which it belongs , the object cache stack is shown in Figure 6.

如图4所示,是分配一个类型为A的对象时发生的过程。若该分配点是经过优化的分配点,则会触发如图8所示的分配过程。As shown in Figure 4, it is the process that occurs when an object of type A is allocated. If the distribution point is an optimized distribution point, the distribution process shown in FIG. 8 will be triggered.

如图5所示,是缓存空间的组织结构。一个缓存空间主要有两个部分组成:一是管理缓存空间本身所需要的元数据,如图5左上方所示,二是一个或多个用于分配对象的内存块,称为Chunk。缓存空间的元数据包含两个字段,描述如下:As shown in Figure 5, it is the organizational structure of the cache space. A cache space mainly consists of two parts: one is the metadata required to manage the cache space itself, as shown in the upper left of Figure 5, and the other is one or more memory blocks used to allocate objects, called Chunk. The metadata of the cache space contains two fields, described as follows:

1)cur_chunk,指向当前内存块,缓存空间将多个内存块用一个链表组织起来,cur_chunk就指向这个链表的头结点,同时每次分配对象时也总是从当前内存块中分配。1) cur_chunk, pointing to the current memory block, the cache space organizes multiple memory blocks with a linked list, cur_chunk points to the head node of this linked list, and at the same time, every time an object is allocated, it is always allocated from the current memory block.

2)lock,用于同步多个线程对同一个缓存空间的访问。2) lock, which is used to synchronize access of multiple threads to the same cache space.

此外,每一个内存块的起始部分存放该内存块的元数据,包含三个字段,描述如下:In addition, the initial part of each memory block stores the metadata of the memory block, including three fields, described as follows:

1)size,存储该内存块的总大小,单位为字节;1) size, stores the total size of the memory block, in bytes;

2)free_ptr,空闲指针表示下一次在该内存块中分配对象时的起始位置;2) free_ptr, the free pointer indicates the starting position when the object is allocated in the memory block next time;

3)next_chunk,指向下一个内存块的指针,用于将缓存空间中所有的内存块链接在一起。3) next_chunk, a pointer to the next memory block, used to link all memory blocks in the cache space together.

图5中Chunk A和Chunk B为两个内存块,Chunk A为当前内存块,Chunk B的末尾有一部分内存没有分配出去,原因是这段剩余的空闲内存太小,无法满足对象的分配要求。每次从缓存空间中分配对象时,总是从当前内存块cur_chunk中获取内存。缓存空间中的内存块从不释放,直到虚拟机被销毁时才返还给操作系统。In Figure 5, Chunk A and Chunk B are two memory blocks. Chunk A is the current memory block. A part of the memory at the end of Chunk B is not allocated because the remaining free memory is too small to meet the allocation requirements of the object. Every time an object is allocated from the cache space, memory is always obtained from the current memory block cur_chunk. Memory blocks in the cache space are never freed and are not returned to the operating system until the virtual machine is destroyed.

如图6所示,为类class的元数据结构与对象缓存栈的关系。每一个Java程序中的类在虚拟机内部都有一个如图6所示的数据结构表示它,称之为类的元数据,它存放了这个类的方法、字段、父类、接口函数等信息。为选择的重用价值高的类设置对象缓存栈。在图6中,类的元数据结构中的缓存栈指针cache_stack指向对象缓存栈C_stack,对象缓存栈中保存了垃圾收集器放入的类型为X的死亡对象的地址。对象缓存栈也可以用其它数据结构实现,如队列,但用栈的好处是其后进先出的特性意味着分配的对象总是最近被回收的,可增加CPU的缓存命中率。As shown in Figure 6, it is the relationship between the metadata structure of the class class and the object cache stack. Each class in a Java program has a data structure as shown in Figure 6 inside the virtual machine to represent it, called the metadata of the class, which stores information such as methods, fields, parent classes, interface functions, etc. of this class . Set up an object cache stack for selected classes with high reuse value. In Figure 6, the cache stack pointer cache_stack in the metadata structure of the class points to the object cache stack C_stack, and the object cache stack stores the address of the dead object of type X placed by the garbage collector. The object cache stack can also be implemented with other data structures, such as queues, but the advantage of using the stack is that its last-in-first-out feature means that the allocated objects are always reclaimed recently, which can increase the cache hit rate of the CPU.

如图7所示,为正常的对象分配流程和优化后的对象分配流程。上部的虚线框部分为正常的分配对象的流程,下部的实线框为优化后的对象分配流程。在分配那些重用价值高的对象时,需要对分配这些对象的分配点进行特殊处理,生成的机器代码将调用CacheAlloc函数进行对象的分配,该函数的执行步骤如下:As shown in FIG. 7, it is a normal object allocation process and an optimized object allocation process. The upper dotted box part is the normal process of allocating objects, and the lower part of the solid line box is the optimized object allocation process. When allocating objects with high reuse value, special processing needs to be done on the allocation points for allocating these objects. The generated machine code will call the CacheAlloc function to allocate objects. The execution steps of this function are as follows:

步骤一,获取对象的class元数据结构中的指针cache_stack。Step 1, obtain the pointer cache_stack in the class metadata structure of the object.

步骤二,根据class指针cache_stack,得到该类型的对象缓存栈C_stack;Step 2, get the object cache stack C_stack of this type according to the class pointer cache_stack;

步骤三,若对象缓存栈C_stack不为空,则按照图8左侧虚线所示流程进行对象分配,将从对象缓存栈C_stack中分配缓存的同类型死亡对象。若对象缓存栈C_stack为空,将从缓存空间中分配对象,转到步骤四执行。Step 3, if the object cache stack C_stack is not empty, perform object allocation according to the process shown by the dotted line on the left side of Figure 8, and allocate the cached dead objects of the same type from the object cache stack C_stack. If the object cache stack C_stack is empty, the object will be allocated from the cache space and go to step 4 for execution.

步骤四,按照图8中右侧实线部分,从缓存空间中分配对象。Step 4, allocate objects from the cache space according to the solid line on the right in Figure 8.

如图8所示,分别展示了从对象缓存栈C_stack和缓存空间分配对象的流程,是对图7的续接。左侧虚线为从对象缓存栈C_stack中取栈顶元素的部分。需经过如下步骤:As shown in Figure 8, it shows the process of allocating objects from the object cache stack C_stack and the cache space respectively, which is a continuation of Figure 7. The dotted line on the left is the part where the top element of the stack is fetched from the object cache stack C_stack. Need to go through the following steps:

第一步,获取对象缓存栈C_stack的锁;The first step is to acquire the lock of the object cache stack C_stack;

第二步,保存栈顶元素到一个零时变量obj,然后弹出栈顶元素;The second step is to save the top element of the stack to a zero-time variable obj, and then pop the top element of the stack;

obj=C_stack.pop();obj = C_stack. pop();

第三步,释放对象缓存栈C_stack的锁;The third step is to release the lock of the object cache stack C_stack;

第四步,返回obj。obj是所选择的死亡对象的地址,即分配重用对象的地址。The fourth step is to return obj. obj is the address of the chosen dead object, i.e. the address of the object allocated for reuse.

例如,对照图3到图4发生的变化,分配类型为A的对象时,由于相应的对象缓存栈C_stack不为空,因此直接取栈顶元素即可,重复利用了之前对象占用的内存空间,同时避免了和垃圾收集器交互。For example, comparing the changes in Figure 3 to Figure 4, when an object of type A is allocated, since the corresponding object cache stack C_stack is not empty, the top element of the stack can be directly taken, and the memory space occupied by the previous object is reused. At the same time, it avoids interacting with the garbage collector.

右侧实线为从缓存空间中分配对象需经过如下步骤:The solid line on the right is the following steps to allocate objects from the cache space:

第1步,获取缓存空间锁;Step 1, acquire the cache space lock;

第2步,若缓存空间中当前内存块的空闲内存满足对象大小,则先将当前内存块的free_ptr值赋予临时变量obj,然后让free_ptr增加对象的大小obj_size;若当前内存块的空闲内存小于对象大小,则转到第5步;Step 2, if the free memory of the current memory block in the cache space satisfies the size of the object, first assign the free_ptr value of the current memory block to the temporary variable obj, and then let free_ptr increase the size of the object obj_size; if the free memory of the current memory block is smaller than the object size, go to step 5;

第3步,释放缓存空间锁;Step 3, release the cache space lock;

第4步,返回obj,obj为分配重用对象的地址;Step 4, return obj, obj is the address of the allocated reused object;

第5步,向操作系统申请一个新的内存块,将该内存块作为当前内存块,并更新cur_chunk和free_ptr的值,转到第2步。Step 5, apply for a new memory block from the operating system, use this memory block as the current memory block, update the values of cur_chunk and free_ptr, and go to step 2.

本发明的创新点主要在于设置了缓存空间,重用死亡对象,对选定的重用价值高的对象采用本发明上述方法进行优化分配。重用价值高的对象是指在程序中大量分配又大量死亡的一些对象。The innovation of the present invention mainly lies in that a cache space is set, dead objects are reused, and the selected objects with high reuse value are optimally allocated by the above-mentioned method of the present invention. Objects with high reuse value refer to some objects that are allocated in large numbers and die in large numbers in the program.

Claims (4)

1. the method for dynamic reuse object in internal memory garbage collector, it is characterised in that realized by following aspect:
(1) organizational form of spatial cache is set;Memory block is organized by spatial cache with a chained list.The unit of spatial cache Packet contains two field: cur_chunk and lock;Cur_chunk points to the head node of chained list, and lock is used for synchronizing thread pair The access of same spatial cache;Memory block is used for distribution object, and the start-up portion of each memory block deposits first number of memory block According to, comprise three fields: size, free_ptr and next_chunk;Total size of stored memory block, free_ in field size Ptr is free pointer, represents original position during distribution object in this memory block next time, and next_chunk is for pointing to next The pointer of individual memory block;Memory block in spatial cache never discharges, until just returning to operating system when virtual machine is destroyed;
(2) the costly class of reusing for selecting all arranges target cache stack, deposits sensing target cache in the metadata of class The pointer of stack, preserves the address of the dead object of the corresponding class that garbage collector is put in target cache stack;
(3) when object is reused in distribution, the target cache stack of correspondence is found according to the metadata of the class reusing object, if object delays Deposit stack not for empty, from target cache stack, distribute the same type death object of caching, if target cache stack is empty, from spatial cache Middle distribution object.
A kind of method of dynamic reuse object in internal memory garbage collector the most according to claim 1, it is characterised in that The described same type death object distributing caching from target cache stack, specifically:
The first step, obtains the lock of target cache stack;
Second step, preserves stack top element to zero variations per hour obj, then ejects stack top element;
3rd step, the lock of releasing object caching stack;
4th step, returning obj, obj is the address that object is reused in distribution.
A kind of method of dynamic reuse object in internal memory garbage collector the most according to claim 1, it is characterised in that Described distribution object from spatial cache, specifically:
1st step, obtains the lock of spatial cache;
2nd step, if the free memory of current memory block meets object size in spatial cache, the most first by current memory block Free_ptr value gives temporary variable obj, then allows free_ptr increase the size of object;If the free memory of current memory block Less than object size, then forward the 5th step to;
3rd step, release spatial cache lock;
4th step, returning obj, obj is the address that object is reused in distribution;
5th step, to one new memory block of operating system application, using this memory block as current memory block, and updates cur_ The value of chunk and free_ptr, forwards the 2nd step to and performs.
A kind of method of dynamic reuse object in internal memory garbage collector the most according to claim 1, it is characterised in that Described target cache stack, it is also possible to replace with queue, to preserve the dead object of the corresponding class that garbage collector is put into Address.
CN201610638602.9A 2016-08-05 2016-08-05 A Method for Dynamically Reusing Objects in Memory Garbage Collector Active CN106293939B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610638602.9A CN106293939B (en) 2016-08-05 2016-08-05 A Method for Dynamically Reusing Objects in Memory Garbage Collector

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610638602.9A CN106293939B (en) 2016-08-05 2016-08-05 A Method for Dynamically Reusing Objects in Memory Garbage Collector

Publications (2)

Publication Number Publication Date
CN106293939A true CN106293939A (en) 2017-01-04
CN106293939B CN106293939B (en) 2019-10-18

Family

ID=57665655

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610638602.9A Active CN106293939B (en) 2016-08-05 2016-08-05 A Method for Dynamically Reusing Objects in Memory Garbage Collector

Country Status (1)

Country Link
CN (1) CN106293939B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857814A (en) * 2018-12-28 2019-06-07 北京东方国信科技股份有限公司 A kind of internal storage data processing method and storage medium
WO2019184776A1 (en) * 2018-03-27 2019-10-03 阿里巴巴集团控股有限公司 Data caching method and device
CN116860658A (en) * 2023-06-21 2023-10-10 中国科学院软件研究所 Efficient semi-automatic garbage collection method and system for big data processing frame

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020161894A1 (en) * 2001-04-27 2002-10-31 International Business Machines Corporation Mechanism to cache references to Java RMI remote objects implementing the unreferenced interface
CN1604051A (en) * 2003-09-30 2005-04-06 三星电子株式会社 Method and apparatus for performing dynamic memory management by an object-oriented program
US7263700B1 (en) * 2000-11-06 2007-08-28 International Business Machines Corporation Serially, reusable virtual machine
CN101046755A (en) * 2006-03-28 2007-10-03 郭明南 System and method of computer automatic memory management
CN101169759A (en) * 2007-11-08 2008-04-30 Ut斯达康通讯有限公司 Memory management method for application program
CN102023891A (en) * 2010-12-20 2011-04-20 复旦大学 Concurrent garbage collector frame based on Java virtual machine
CN102722447A (en) * 2012-06-06 2012-10-10 北京航空航天大学 Incremental track record method of object state in memory garbage collector

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7263700B1 (en) * 2000-11-06 2007-08-28 International Business Machines Corporation Serially, reusable virtual machine
US20020161894A1 (en) * 2001-04-27 2002-10-31 International Business Machines Corporation Mechanism to cache references to Java RMI remote objects implementing the unreferenced interface
CN1604051A (en) * 2003-09-30 2005-04-06 三星电子株式会社 Method and apparatus for performing dynamic memory management by an object-oriented program
CN101046755A (en) * 2006-03-28 2007-10-03 郭明南 System and method of computer automatic memory management
CN101169759A (en) * 2007-11-08 2008-04-30 Ut斯达康通讯有限公司 Memory management method for application program
CN102023891A (en) * 2010-12-20 2011-04-20 复旦大学 Concurrent garbage collector frame based on Java virtual machine
CN102722447A (en) * 2012-06-06 2012-10-10 北京航空航天大学 Incremental track record method of object state in memory garbage collector

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈贤闯 等: "一种基于栈式分配的JVM垃圾收集算法", 《计算机系统应用》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019184776A1 (en) * 2018-03-27 2019-10-03 阿里巴巴集团控股有限公司 Data caching method and device
CN110309079A (en) * 2018-03-27 2019-10-08 阿里巴巴集团控股有限公司 A kind of method and device of data buffer storage
CN109857814A (en) * 2018-12-28 2019-06-07 北京东方国信科技股份有限公司 A kind of internal storage data processing method and storage medium
CN116860658A (en) * 2023-06-21 2023-10-10 中国科学院软件研究所 Efficient semi-automatic garbage collection method and system for big data processing frame
CN116860658B (en) * 2023-06-21 2024-05-28 中国科学院软件研究所 Efficient semi-automatic garbage collection method and system for big data processing frame

Also Published As

Publication number Publication date
CN106293939B (en) 2019-10-18

Similar Documents

Publication Publication Date Title
US11042477B2 (en) Memory management using segregated free lists
CN108038002B (en) Embedded software memory management method
US7165255B2 (en) Method and apparatus for managing surplus memory in multitasking system
US6105040A (en) Method and apparatus for managing stored objects
CN103514102B (en) A kind of Java Virtual Machine realizes the method and device of internal memory garbage reclamation
US8805896B2 (en) System and method for use with garbage collected languages for enabling the allocated heap memory to be updated at runtime
US10372601B2 (en) Managing memory in a computer system
US20140115291A1 (en) Numa optimization for garbage collection of multi-threaded applications
JP2005216298A (en) Adaptive garbage collection method and apparatus for performing the method
CN104731799A (en) In-memory database management device
CN114327917A (en) Memory management method, computing device and readable storage medium
CN106293939B (en) A Method for Dynamically Reusing Objects in Memory Garbage Collector
CN105718319B (en) Memory pool layout analysis method and memory pool device
CN103593300B (en) Memory allocating and collecting method
CN112650577A (en) Memory management method and device
US8447793B2 (en) Efficient remembered set for region-based garbage collectors
CN103488577A (en) Method and device of memory allocation and batch recovery for user applications based on use numbering
CN114051610B (en) Arena-based memory management
CN1321377C (en) Control method of smart card storage environment
EP3807771B1 (en) Arena-based memory management
CN108563507A (en) A kind of EMS memory management process, device, equipment and readable storage medium storing program for executing
US20080034022A1 (en) System and method for updating references when incrementally compacting a heap
US9753850B1 (en) On-heap huge slab allocator
CN115033378B (en) Management method for volatile memory
US8024378B2 (en) System and method to reduce the promotion rate in a generational garbage collector in a virtual machine environment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant