CN102722415B - Garbage collecting method based on Java system on chip (SoC) with stack system structure - Google Patents

Garbage collecting method based on Java system on chip (SoC) with stack system structure Download PDF

Info

Publication number
CN102722415B
CN102722415B CN201210161655.8A CN201210161655A CN102722415B CN 102722415 B CN102722415 B CN 102722415B CN 201210161655 A CN201210161655 A CN 201210161655A CN 102722415 B CN102722415 B CN 102722415B
Authority
CN
China
Prior art keywords
garbage
java
thread
collector
subspace
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.)
Active
Application number
CN201210161655.8A
Other languages
Chinese (zh)
Other versions
CN102722415A (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.)
Guangzhou Kingray Information Technology Co., Ltd.
SYSU HUADU INDUSTRIAL SCIENCE AND TECHNOLOGY INSTITUTE
Original Assignee
GUANGZHOU KINGRAY INFORMATION TECHNOLOGY Co Ltd
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 GUANGZHOU KINGRAY INFORMATION TECHNOLOGY Co Ltd filed Critical GUANGZHOU KINGRAY INFORMATION TECHNOLOGY Co Ltd
Priority to CN201210161655.8A priority Critical patent/CN102722415B/en
Publication of CN102722415A publication Critical patent/CN102722415A/en
Application granted granted Critical
Publication of CN102722415B publication Critical patent/CN102722415B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Memory System (AREA)

Abstract

The invention discloses a garbage collecting method based on a Java system on chip (SoC) with a stack system structure, which is used for a multi-thread dynamic scheduling garbage collector and used for recovering garbage. The life cycle of the Java SoC is divided into a system initialization stage and a real-time task stage, wherein at the Java SoC initialization stage, a Java virtual machine actively calls the garbage collector to carry out single-thread explicit called garbage collection; when an abnormity of 'memory insufficiency' happens, the Java SoC triggers and calls the garbage collector to carry out single-thread explicit called garbage collection; and at the multi-thread real-time task operation stage, a concurrent collector thread schedules the garbage collector to collect garbage in a cycle TC. The garbage collection workflow of the garbage collector comprises the following steps of: 1) scanning root set objects in the Java SoC; 2) marking; 3) copying non-garbage objects from a subspace fromespace to a subspace tospace; 4) sweeping handles; 5) emptying the subspace fromespace; and 6) turning the subspaces fromespace and tospace over.

Description

Garbage collection method based on stack system structure Java SoC system
Technical field
The present invention designs a kind of JavaSoC garbage collection method, specifically, designs the garbage collection method that a kind of multithreading dynamic dispatching garbage collector carries out the JavaSoC system based on stack system structure of garbage reclamation.
Background technology
In recent years, Java technology relies on its unique professional platform independence, and good encapsulation and security etc. are widely used in embedded system.Along with the fast development of superelevation integrated level chip technology and technique, with hardware, realizing JVM (Java Virtual Machine) becomes possibility simultaneously, and Java processor arises at the historic moment.JavaSoC is that Java processor core, system bus and peripheral control unit etc. are module integrated to a small chip, travelling speed and the processing power of java applet have not only been improved significantly, and integrated abundant peripheral interface, for Embedded System Design, particularly embedded Java calculates and applies provides a kind of good solution.
Java technology is based upon on the basis of automatic memory management, and application developer can free from the memory management logic of involved and abstruse complexity, is absorbed in the design of applied business logic, and this feature makes Java become " favorite " of large scale system exploitation.And all Java automatic memory managements are all to adopt garbage reclamation mechanism to complete, the main body of bearing this function is exactly the important composition module of JVM---garbage collector (GarbageCollector, hereinafter to be referred as GC).The GC of main flow PC platform requires higher to system resource, its running status is generally unpredictable, is not suitable for embedded and real time environment, otherwise this type systematic does not generally possess garbage reclamation function yet.
In the patented claim of Chinese Patent Application No. 200710026998.2 " Java card system rubbish recovering method ", a kind of Java card rubbish recovering method is disclosed, adopt the single-threaded explicit refuse collection of calling, stop owning (Stop-The-World, abbreviation STW) working method, when starting, refuse collection stops carrying out other application program, this mode can realize garbage reclamation, but the application for embedded real time environment field, the one side needed time of unpredictable refuse collection, cannot guarantee on the other hand to have reclaimed enough utilizable internal memories when application program is carried out, so cannot meet the high real-time requirement of built-in field.
Summary of the invention
For above deficiency, the invention provides and a kind ofly can greatly guarantee that the multithreading dynamic dispatching garbage collector of the real-time of refuse collection carries out the garbage collection method of the JavaSoC system based on stack system structure of garbage reclamation, it is divided into system initialisation phase and two stages of real-time task stage by the life cycle of JavaSoC system, in JavaSoC system initialisation phase, by Java Virtual Machine, initiatively call garbage collector and carry out the single-threaded explicit refuse collection of calling; When generation " low memory " is abnormal, by JavaSoC system triggers, calls garbage collector and carry out the single-threaded explicit refuse collection of calling; In the multithreading real-time task operation phase, by a concurrent collector thread with cycle T cscheduling garbage collector carries out refuse collection, and wherein, collector represents to bear the thread of concrete garbage collector logic, T cthe cycle that represents collector thread.
Three GC chained lists of handle pond definition of described JavaSoC system, freeList does not point to any object or its sensing garbage object for storing has reclaimed complete handle; GreyList is used for storing all by collector thread accesses mistake, but its reference to variable does not have the object handle of traversal; UsedList is for storing the handle of an object of positive sense.
The workflow of the refuse collection of described garbage collector is:
Step 1, object scan: the root set pair in JavaSoC system is resembled and scanned, in scanning process, the stacked data of the object of all references in static fields table or mutator thread is pressed into the labeled slots that greyList forms, and wherein, mutator represents to bear the user thread of application task;
Step 2, mark: from labeled slots greyList, eject an object reference, from its handle, find object-type information, obtain the information GC.info of the instance data type of this object, according to the sequencing of stating in class each corresponding instance variable of GC.info from low to high, if a certain instance variable is reference type, corresponding position 1, garbage collector is according to the GC.info of object type, all objects of this object reference are stacked, be labeled as grey object;
Step 3, copy: will in JavaSoC system, can be divided into fromspace and tospace two sub spaces by distribution object heap, first obtain the size that need to copy instance objects, then upgrade the handle structure information of this object reference, finally a non-garbage object is copied to the tospace of subspace from subspace fromespace, completes the copy of instance data;
Step 4, cleaning handle: after copy finishes, check whether the handle in usedList chained list points to subspace tospace, if not, what its sensing was described is garbage object, can reclaim this handle to redistribute utilization, be about to it and add freeList chained list to;
Step 5, empty subspace fromspace;
Step 6, subspace upset: the turning operation of atomicity, thus exchange pointer value is exchanged the role of subspace fromspace sum of subspace tospace.
In described JavaSoC system, root set pair resembles source two kinds:
1) the static reference to variable object pointed in the static referring domain table in method district;
2) the reference to variable object pointed in mutator thread stacks,
When JavaSoC Installed System Memory deficiency or system initialisation phase complete, only to root collection source 1) in object scan, when entering the multithreading real-time task stage, periodically scan root collection source 1) and root collection originate 2).
The marking operation of described step 2 only occurs in the fromspace of subspace, when the circulation of collector thread starts, at subspace tospace, distributes new object.
Beneficial effect of the present invention:
1, the present invention adopts the concurrent mode of thread to support increment to collect, thread is divided into mutator and collector two classes: mutator represents to bear the user thread of application task, collector represents to bear concrete GC(garbage collector) logic thread, prevent refuse collection work and object distribute interweave to together with, while is for the difference of system operation task, the life cycle of JavaSoC is divided into system initialisation phase and two stages of real-time task stage, improve the efficiency of processor, saved processor resource.
2, the present invention uses for reference Dijkstra classics " baihuixiong " trichromatic diagram algorithm, by 3 GC chained lists of handle pond definition of JavaSoC, freeList does not point to any object or its sensing garbage object for storing has reclaimed complete handle, greyList is for storing all access by collector but its reference to variable does not have the object handle traveling through, and usedList is used for storing the handle of an object of positive sense.At GC, in the cycle, collector can start to scan whole handle pond from the handle of some root object, and all objects with adduction relationship all can experience a stage that becomes grey object, and their handle all can be pressed in greyList; At cleaning handle stage collector, can, from be hit by a bullet out grey object handle copy its object pointed to tospace of greyList, be equivalent to black to object, and its handle is added in usedList; When rotary movement occurs, all not objects in usedList have all become untouchable white object and have been recovered." tree " or more complicated " graph structure " that with chained list, replace description object adduction relationship, the chain table handling and the tree-like traversal that adopt storehouse LIFO form to realize have kept compatibility, the uncertain time complexity of having avoided pure recursive call to produce, meets embedded GC requirement of real-time.
3, in the present invention, the source of root collection scanning root object comprises object and the object pointed of the reference to variable in thread stacks pointed of the static reference to variable in static referring domain table in method district, using for reference the thought of SCJ standard simplifies threading model, the mutator that does not allow to be in scheduling sequence carries out from blocking (self-blocking) operation, give collector thread the longest closing time simultaneously, be that collector thread operates in lowest priority, while all mutator threads such as only having to return, just start collector thread from task call separately, now other thread stacks are all empty, root object is only present in static fields, advantage is that GC does not need to scan storehouse, JavaSoC also can obtain good real-time performance in GC process.
4, only need assignment instance variable during copy object of the present invention, the handle value of then upgrading in handle is pointed to new address, just can easily complete whole copy function, accelerated concurrent-copy the work efficiency of gatherer.
Accompanying drawing explanation
Fig. 1 is the processing flow chart of garbage collection method of the present invention;
Fig. 2 is the workflow diagram of garbage collector of the present invention;
Fig. 3 is object storage organization schematic diagram of the present invention;
Fig. 4 is the structural drawing in the handle pond of JavaSoC system of the present invention;
Fig. 5 is the processing flow chart of method of the present invention district layout signal.
Embodiment
Below in conjunction with accompanying drawing, the present invention is further elaborated.
Garbage collection method of the present invention is for the JavaSoC system based on stack system structure, this system only supports Java as target language, nation method adopts microcode or Java subroutine to realize, microcode is all realized by hardware circuit, so do not need to design nation method stack, in specific implementation, physical storage is divided into RAM on the outer RAM of processor piece and sheet, the former is for the distribution of method district and heap, the latter is used for building Java stack, through balance, its method is divided into static fields table, byte code table, class formation table, character string constant table and JVM redundant information table five part, as shown in Figure 5.
As shown in Figure 1, the garbage collection method of the JavaSoC system based on stack system structure of the present invention is divided into system initialisation phase and two stages of real-time task stage by the life cycle of JavaSoC system, thread is divided into mutator thread and collector thread two classes: mutator thread is born the user thread of application task, collector thread is born concrete GC logic, in JavaSoC system initialisation phase, by Java Virtual Machine, initiatively call garbage collector and carry out the single-threaded explicit refuse collection of calling; When generation " low memory " is abnormal, by JavaSoC system triggers, calls garbage collector and carry out the single-threaded explicit refuse collection of calling; In the multithreading real-time task operation phase, by a concurrent collector thread with cycle T cscheduling garbage collector carries out refuse collection, wherein, and T cthe cycle that represents collector thread.
In the present invention, the heap space of JavaSoC is divided into handle pond and two parts of object heap, the corresponding object of each handle, object storage instance variable data, the pointer that handle has comprised a point at objects first address, object storage as shown in Figure 3, the agent object heap of garbage collector (in JavaSoC system can distribution object heap) is divided into fromspace and tospace two sub spaces, object heap is divided into fromspace and tospace two sub spaces, size is respectively H fromand H to, M represents the memory size having distributed in subspace, specifically uses M fromand M torepresent, G represents the size of the garbage object that will be reclaimed by gatherer when the GC cycle starts, the size of that represent to distribute in the current GC cycle but untouchable floating object, these objects will be scanned recovery in the cycle at next GC, L represents it is the size of all moving objects, A represents the size in the new distribution object of mutator thread space in current GC circulation, reference copies diversity, to in JavaSoC system can distribution object the big or small H of heap derive, through method of induction, derive and draw:
H=2(L max+A max)
Like this, can guarantee can not exhaust at the internal memory of any GC cycle JavaSoC system.
The present invention is based on mutator thread and determine the cycle of collector, be i.e. GC cycle T cthe maximal value L that while depending on circulation beginning, moving object takes up room maxthe maximum memory object distributing with mutator thread in the current circulation A that takes up room max, set in JavaSoC sets of threads one total n mutually between independent mutator thread, the periodic table of mutator thread i is shown T i, in monocycle distribution, save as a i, use for reference based on classical thread Share Model---the producer/consumer model, derive collector thread cycle T cas follows:
T C ≤ H - 2 Σ i = 1 n a i l i - 2 Σ i = 1 n a i 2 Σ i = 1 n a i T i
Definition three GC chained lists in the handle pond of JavaSoC system in the present invention, chained list as shown in Figure 4, use for reference " baihuixiong " trichromatic diagram algorithm of Dijkstra classics, freeList does not point to any object or its sensing garbage object for storing has reclaimed complete handle, greyList is for storing all access by collector but its reference to variable does not have the object handle traveling through, and usedList is used for storing the handle of an object of positive sense.At GC, in the cycle, collector can start to scan whole handle pond from the handle of some root object, and all objects with adduction relationship all can experience a stage that becomes grey object, and their handle all can be pressed in greyList; At cleaning handle stage collector, can, from be hit by a bullet out grey object handle copy its object pointed to tospace of greyList, be equivalent to black to object, and its handle is added in usedList; When rotary movement occurs, all not objects in usedList have all become untouchable white object and have been recovered." tree " or more complicated " graph structure " that with chained list, replace description object adduction relationship, advantage is that the chain table handling and the tree-like traversal that adopt storehouse LIFO form to realize have kept compatibility, the uncertain time complexity of having avoided pure recursive call to produce, meets embedded GC requirement of real-time.
As shown in Figure 2, the workflow of garbage collector of the present invention is as follows:
Step 1, scanning root collection: in JavaSoC, root set pair resembles source two kinds: the static reference to variable object pointed in the static referring domain table in (1) method district, the reference to variable object pointed in (2) mutator thread stacks.When low memory or system initialisation phase complete, only root collection source (1) is scanned; When entering the multithreading real-time task stage, need to periodically scan root collection source (1) and (2).In scanning process, the stacked data of all references in static fields table or mutator thread is pressed into the labeled slots that greyList forms.
Step 2, mark: from labeled slots greyList, eject an object reference, from its handle, find object-type information, obtain thus the GC.info of object, here the information that has comprised object instance data type, according to the sequencing of stating in class each corresponding instance variable of GC.info from low to high, if a certain instance variable is reference type, corresponding position 1.GC is according to the GC.info of object type, and all objects (white) of this object reference are stacked, is labeled as grey object.
Step 3, copy: a non-garbage object is copied to tospace from fromespace; First obtain the size that need to copy instance objects, then upgrade the handle structure information of this object reference, finally call the copy that nation method and hardware copy cell complete instance data.
Step 4, cleaning handle: after copy finishes, GC can clean handle pond, check whether the handle in usedList chained list points to tospace (dark object), if not, what its sensing was described is garbage object, can reclaim this handle to redistribute utilization, be about to it and add freeList chained list to.
Step 5, empty subspace fromspace: in GC work end stage, fromspace is remaining white object only, finally uses the 0 whole space of initialization; This space of next time overturning becomes tospace, can save this operation of acquiescence initialization while redistributing object, accelerates the speed that object generates.
Step 6, subspace upset: the turning operation of atomicity, thus exchange pointer value is exchanged fromspace and tospace role.
The mark action of step 2 only occurs in fromspace; When collector circulation starts, at tospace, distribute new object, avoided the new object that created by mutator because untouchable and become floating refuse within return period, also reduced the quantity copying in step 3.Before end cycle, carry out a simple rotary movement, exchange the role of two sub spaces, enter the recovery operation of next round, advantage is to remove most copy functions from, to real-time, provides good guarantee effect.
In the present invention to JavaSoC can distribution object the big or small H of heap derive, for guaranteeing that GC is in the cycle arbitrarily, JavaSoC can not exhaust internal memory, meets
H=H From+H To≥M From+M To (1)
Derive any and once reclaim in circulation, the maximal value L that when upper bound of total internal memory M that every sub spaces has been distributed is circulation beginning, moving object takes up room maxthe maximum memory object distributing with mutator thread in the current circulation A that takes up room maxsum,
M≤L max+A max (2)
Adopt method of induction to prove formula (2), subscript n represents cycle index, and S and E represent respectively beginning and the end of circulation.
First determine following several useful equatioies, as mentioned before, in conservative increment type is collected, floating refuse object when the n time circulation finishes will become the garbage object of the n+1 time circulation,
G n + 1 = G ~ E n - - - ( 3 )
The moving object of moving object when the n time circulation finishes when becoming the n+1 time circulation beginning,
L S n + 1 = L E n - - - ( 4 )
When circulation starts, the space M having distributed in fromspace fromgarbage object G and moving object L have been comprised s, have
M From=G+L S (5)
All new objects all distribute in tospace, therefore at the inner memory headroom for fromspace of circulation, require to remain unchanged, and all garbage object G are kept in fromspace, only comprise floating refuse and moving object, in tospace
M To = G ~ + L - - - ( 6 )
At the beginning of the cycle, tospace is entirely sky,
M To_S=0 (7)
In circulation, all moving objects are copied into tospace, and all new objects also distribute in this subspace, therefore have
M To_E=L S+A (8)
When circulation finishes, initial moving object L sand newly assigned object A or become floating refuse, or maintenance activity,
L S + A = L E + G ~ E - - - ( 9 )
Proof is for circulation for the first time below, and formula (2) is set up.In circulation for the first time, there is no at first garbage object and moving object,
G=0 and L s=0
Show that fromspace is empty, obviously meet formula (2).Tospace only has all newly assigned object A of this circulation 1, and A 1≤ A max, also meet formula (2).Therefore formula (2) is set up for circulation for the first time.
Now suppose that formula (2) sets up for the n time circulation, proof is also set up for the n+1 time below,
M From n + 1 ≤ L max + A max M To n + 1 ≤ L max + A max - - - ( 10 )
When circulation starts, turning operation is carried out in subspace, and new tospace is cleared, and has
For fromspace, have
M From n = G n + L S n - - - ( 12 )
M From n + 1 = G n + 1 + L S n + 1 = G ~ E n + L E n = L S n + A n - - - ( 13 )
Separately due to L s≤ L maxand A n≤ A maxtherefore, have
M From n + 1 ≤ L max + A max - - - ( 14 )
For tospace, have
M To n = G ~ E n + L E n - - - ( 15 )
M To n + 1 = G ~ E n + 1 + L E n + 1 = L S n + 1 + A n + 1 = L E n + A n + 1 - - - ( 16 )
Separately due to L e≤ L maxand A n+1≤ A maxtherefore, have
M To n + 1 ≤ L max + A max - - - ( 17 )
So for the n+1 time circulation, formula (2) is also to set up.
In sum, formula (2) is all set up in arbitrary circulation, so be the Greatest lower bound of subspace Memory Allocation.Because fromspace and tospace space size are equal,
H From = H To = H 2 - - - ( 18 )
In conjunction with formula (1) and (2), the size minimum of whole heap can be taken as
H=2(L max+A max) (19)
The present invention is based on mutator thread and determine the cycle of collector, be i.e. GC cycle T cthe maximal value L that while depending on circulation beginning, moving object takes up room maxthe maximum memory object distributing with mutator thread in the current circulation A that takes up room max.Set in JavaSoC sets of threads one total n mutually between independent mutator thread, the periodic table of mutator thread i is shown T i, in monocycle distribution, save as a i.According to supposition, have
L max = Σ i = 1 n a i - - - ( 20 )
Notice that formula (20) is considered and used worst condition and rounded up, but be not easy to computational analysis, therefore use a more conservative estimated value A ' maxreplace A max, as follows
Formula (15) and formula (16) have provided the heap size H of gatherer minminimum value,
H ≥ 2 ( L max + A max ) ≥ 2 Σ i = 1 n a i + 2 Σ i = 1 n ( T C T i ) a i - - - ( 23 )
For given H, can obtain T cconservative estimation value, as follows:
2 A max ' ≤ H - 2 L max 2 Σ i = 1 n ( T C T i + 1 ) a i ≤ H C - 2 L max - - - ( 24 )
T C ≤ H - 2 L max - 2 Σ i = 1 n a i 2 Σ i = 1 n a i T i - - - ( 25 )
⇒ T C ≤ H - 4 Σ i = 1 n a i 2 Σ i = 1 n a i T i - - - ( 26 )
Consider the shared object that inter-thread communication is used, use for reference based on classical thread Share Model---the producer/consumer model, producer thread has been distributed an object and has been preserved in some way it and quoted so that other thread can be accessed this object; Other thread, consumer is responsible for discharging its internal memory after using this object.Set T prepresent producer thread τ pturnaround time, T crepresent consumer's thread τ cturnaround time; τ peach period allocated a pmemory headroom, so consumer's thread cycle T cin, τ pthe memory headroom distributing is altogether
Worst condition is T cin incipient stage in its cycle with regard to having obtained all objects until the end cycle stage just discharge them.Therefore for this producer/consumer combination, the maximal value L of moving object internal memory maxfor
Introduce a following lifetime factor l i:
L after expanding maxcan be expressed as
L max = Σ i = 1 n a i l i - - - ( 27 )
Due to the release of the responsible all object spaces of collector thread, at a maximal value A who reclaims the memory headroom distributing in circulation maxdo not change, so for the producer/consumer threading model, collector thread cycle T cas follows:
T C ≤ H - 2 Σ i = 1 n a i l i - 2 Σ i = 1 n a i 2 Σ i = 1 n a i T i
In the present invention, the actual address of object is kept in handle, and designed handle, by 8 word alignment, avoids producing memory fragmentation, with regard to object accesses, handle has been realized the dereference of object in the mode of turn pointer, compare with direct access, has introduced overhead; But, JavaSoC has realized independently internal storage access unit, and address translation is completed fast by hardware circuit, effectively reduces time loss and makes it can not cause burden to system operation.Advantage: 1) simplified the expression of object/array itself, the object in heap or array only need to be preserved instance variable or element, and program is also without dereference method table or array size; 2) can expand very easily, to support different internal memory designs; 3) while copying object, only need assignment instance variable, the handle value of then upgrading in handle is pointed to new address, just can easily complete whole copy function, has accelerated the work efficiency of concurrent-copy gatherer.
The foregoing is only better embodiment of the present invention, the present invention is not limited to above-mentioned embodiment, in implementation process, may there is local small structural modification, if various changes of the present invention or modification are not departed to the spirit and scope of the present invention, and within belonging to claim of the present invention and equivalent technologies scope, the present invention is also intended to comprise these changes and modification.

Claims (2)

1. the garbage collection method of the Java SoC system based on stack system structure, it is characterized in that, it is divided into system initialisation phase and two stages of real-time task stage by the life cycle of Java SoC system, in Java SoC system initialisation phase, by Java Virtual Machine, initiatively call garbage collector and carry out the single-threaded explicit refuse collection of calling; When generation " low memory " is abnormal, by Java SoC system triggers, calls garbage collector and carry out the single-threaded explicit refuse collection of calling; In the multithreading real-time task operation phase, by a concurrent collector thread, with cycle T c scheduling garbage collector, carry out refuse collection, wherein, collector represents to bear the thread of concrete garbage collector logic, T cthe cycle that represents collector thread; Three GC chained lists of handle pond definition of wherein said Java SoC system, freeList does not point to any object or its sensing garbage object for storing has reclaimed complete handle; GreyList is used for storing all by collector thread accesses mistake, but its reference to variable does not have the object handle of traversal; UsedList is for storing the handle of an object of positive sense;
The workflow of the refuse collection of described garbage collector is:
Step 1, object scan: the root set pair in Java SoC system is resembled and scanned, in scanning process, the stacked data of the object of all references in static fields table or mutator thread is pressed into the labeled slots that greyList forms, wherein, mutator represents to bear the user thread of application task;
Step 2, mark: from labeled slots greyList, eject an object reference, from its handle, find object-type information, obtain the information GC.info of the instance data type of this object, according to the sequencing of stating in class, each corresponding instance variable of GC.info from low to high, if a certain instance variable is reference type, corresponding position 1, garbage collector is according to the GC.info of object type, and all objects of this object reference are stacked, is labeled as grey object;
Step 3, copy: will in Java SoC system, can be divided into fromspace and tospace two sub spaces by distribution object heap, first obtain the size that need to copy instance objects, then upgrade the handle structure information of this object reference, finally a non-garbage object is copied to the tospace of subspace from subspace fromespace, completes the copy of instance data;
Step 4, cleaning handle: after copy finishes, check whether the handle in usedList chained list points to subspace tospace, if not, what its sensing was described is garbage object, can reclaim this handle to redistribute utilization, be about to it and add freeList chained list to;
Step 5, empty subspace fromspace;
Step 6, subspace upset: the turning operation of atomicity, thus exchange pointer value is exchanged the role of subspace fromspace sum of subspace tospace;
Wherein, in described Java SoC system root set pair resemble source have two kinds:
1) the static reference to variable object pointed in the static referring domain table in method district;
2) the reference to variable object pointed in mutator thread stacks,
When Java SoC Installed System Memory deficiency or system initialisation phase complete, only to root collection source 1) in object scan, when entering the multithreading real-time task stage, periodically scan root collection source 1) and root collection originate 2).
2. the garbage collection method of the Java SoC system based on stack system structure according to claim 1, it is characterized in that, the marking operation of described step 2 only occurs in the fromspace of subspace, when the circulation of collector thread starts, at subspace tospace, distributes new object.
CN201210161655.8A 2012-05-22 2012-05-22 Garbage collecting method based on Java system on chip (SoC) with stack system structure Active CN102722415B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210161655.8A CN102722415B (en) 2012-05-22 2012-05-22 Garbage collecting method based on Java system on chip (SoC) with stack system structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210161655.8A CN102722415B (en) 2012-05-22 2012-05-22 Garbage collecting method based on Java system on chip (SoC) with stack system structure

Publications (2)

Publication Number Publication Date
CN102722415A CN102722415A (en) 2012-10-10
CN102722415B true CN102722415B (en) 2014-11-05

Family

ID=46948192

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210161655.8A Active CN102722415B (en) 2012-05-22 2012-05-22 Garbage collecting method based on Java system on chip (SoC) with stack system structure

Country Status (1)

Country Link
CN (1) CN102722415B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559076B (en) * 2013-11-04 2016-09-28 飞天诚信科技股份有限公司 A kind of method and apparatus using parasitic objects management object heap
CN104808968B (en) * 2014-01-23 2019-04-30 腾讯科技(北京)有限公司 Storage, report method and the device and system of global data
CN105404589B (en) * 2015-10-29 2019-04-30 天脉聚源(北京)教育科技有限公司 A kind of rubbish recovering method and device
CN107239406B (en) * 2016-03-29 2021-03-09 斑马智行网络(香港)有限公司 Parallel marking processing method and device for garbage recovery
CN106599151A (en) * 2016-12-07 2017-04-26 Tcl集团股份有限公司 Method and system for parallel cleaning of Android engineering useless resources
US10572181B2 (en) * 2017-02-01 2020-02-25 Microsoft Technology Licensing, Llc Multiple stage garbage collector
US10558564B2 (en) * 2017-09-28 2020-02-11 Hewlett Packard Enterprise Development Lp Pointers in a memory managed system
CN108845864B (en) * 2018-06-27 2020-11-03 北京京东尚科信息技术有限公司 Spring frame-based JVM garbage recycling method and device
CN108958940A (en) * 2018-07-09 2018-12-07 苏州浪潮智能软件有限公司 A kind of computer processing method and device
KR102620731B1 (en) * 2018-09-27 2024-01-05 에스케이하이닉스 주식회사 Memory system and operating method thereof
CN109726078B (en) * 2018-12-28 2022-12-06 广东亿迅科技有限公司 Method and device for non-invasive JVM thread stack acquisition
CN112114862B (en) * 2019-06-20 2023-12-22 普天信息技术有限公司 Method and device for concurrency processing of spring boot instances
CN113360274A (en) * 2020-03-04 2021-09-07 阿里巴巴集团控股有限公司 Garbage recycling method and device and computing equipment
CN113296883B (en) * 2021-02-22 2023-08-04 阿里巴巴集团控股有限公司 Application management method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101046755B (en) * 2006-03-28 2011-06-15 郭明南 System and method of computer automatic memory management
CN102262591B (en) * 2010-05-31 2014-03-19 国际商业机器公司 Garbage collection method and system for memory copy system
CN102270134B (en) * 2011-08-09 2015-05-27 北京握奇数据系统有限公司 Method and device for recycling garbage in Java card

Also Published As

Publication number Publication date
CN102722415A (en) 2012-10-10

Similar Documents

Publication Publication Date Title
CN102722415B (en) Garbage collecting method based on Java system on chip (SoC) with stack system structure
US7937419B2 (en) Garbage collection via multiobjects
US7143124B2 (en) Detection of dead regions during incremental collection
Sinha et al. Techniques for fine-grained, multi-site computation offloading
CN1321377C (en) Method for controlling smart card storage environment
CN102722432B (en) Follow the trail of the method and apparatus of internal storage access
CN110325969A (en) Multistage garbage collector
US8631051B2 (en) Hybrid fragmenting real time garbage collection
US8447793B2 (en) Efficient remembered set for region-based garbage collectors
US20200327052A1 (en) Compiling application with multiple function implementations for garbage collection
US8990532B2 (en) Method of managing memory in computer system, computer system and memory managing program
CN104035879A (en) Memory allocation and garbage collection method based on life-period prediction
US10936483B2 (en) Hybrid garbage collection
US7058781B2 (en) Parallel card table scanning and updating
Abhinav et al. FastCollect: offloading generational garbage collection to integrated GPUs
Tauro et al. CMS and G 1 Collector in Java 7 Hotspot: Overview, Comparisons and Performance Metrics
Debbabi et al. A dynamic compiler for embedded java virtual machines
Preußer et al. An embedded GC module with support for multiple mutators and weak references
Romanazzi From Manual Memory Management to Garbage Collection
Hu et al. Towards Garbage Collection Mechanism for RTSJ-Oriented Embedded Java Processor
Yau et al. Hardware concurrent garbage collection for short-lived objects in mobile java devices
Al-Oudat An Efficient Strategy for Allocating and Placing Segments in Dynamic Storage
Koide et al. A new memory allocation method for shared memory multiprocessors with large virtual address space
Yang et al. Improved Adaptive Generational Garbage Collection Algorithm for Java Card
Siebert Parallel real-time garbage collection

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20160304

Address after: 510006, No. 8, Jinghu Avenue, Xinhua Street, Huadu District, Guangdong, Guangzhou

Patentee after: Guangzhou Kingray Information Technology Co., Ltd.

Patentee after: SYSU HUADU INDUSTRIAL SCIENCE AND TECHNOLOGY INSTITUTE

Address before: 510006, No. 8, Jinghu Avenue, Xinhua Street, Huadu District, Guangdong, Guangzhou

Patentee before: Guangzhou Kingray Information Technology Co., Ltd.