JP2001265649A - Memory management method and device - Google Patents
Memory management method and deviceInfo
- Publication number
- JP2001265649A JP2001265649A JP2001002477A JP2001002477A JP2001265649A JP 2001265649 A JP2001265649 A JP 2001265649A JP 2001002477 A JP2001002477 A JP 2001002477A JP 2001002477 A JP2001002477 A JP 2001002477A JP 2001265649 A JP2001265649 A JP 2001265649A
- Authority
- JP
- Japan
- Prior art keywords
- car
- handle
- processing
- mark
- train
- 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.)
- Withdrawn
Links
Abstract
(57)【要約】
【課題】 実時間性に優れ、プログレス性が保証された
メモリ管理方法および装置を提供すること。
【解決手段】 オブジェクト本体を記憶領域2に格納
し、オブジェクトを参照するハンドルを記憶領域3に記
憶し、ハンドルにそれを参照しているオブジェクトが所
属するカーの内の最大の大域カー番号を記録する。ガー
ベージコレクションに際して、ガーベージとして回収し
ないオブジェクトを参照するハンドル集合を求め、その
参照先のオブジェクトにマークもしくは移動処理のいず
れかを割り当てる。ついで上記集合に属するハンドルを
参照元最大カー番号以上を満たすカーに移動し、移動処
理が割り当てられたオブジェクトを未使用記憶領域に移
動させ、マーク処理が割り当てられてたオブジェクトに
マークをつける。マークされていないオブジェクトを回
収し、最小トレインからカー、トレインを回収する。
(57) [Summary] [PROBLEMS] To provide a memory management method and device excellent in real-time performance and guaranteed in progress. SOLUTION: An object body is stored in a storage area 2, a handle referring to the object is stored in a storage area 3, and the largest global car number among the cars to which the object referring to the object belongs is recorded in the handle. I do. At the time of garbage collection, a handle set that refers to an object that is not collected as garbage is obtained, and either the mark or the moving process is assigned to the referenced object. Then, the handles belonging to the above set are moved to a car satisfying the reference source maximum car number or more, the object to which the movement processing is assigned is moved to an unused storage area, and the object to which the mark processing is assigned is marked. Retrieve unmarked objects and retrieve cars and trains from the smallest train.
Description
【0001】[0001]
【発明の属する技術分野】Javaという処理系の出現
によって、インターネットから家電用品にいたるまでガ
ーベージコレクション(以下、必要に応じてGCとい
う)を有した言語処理系の重要性が益々増してきてい
る。このような言語では、GCの実行速度が問題とな
り、中断時間の短いGCが必要となる。本発明は、中断
時間の短いGCを行うことができる実時間性に優れ、プ
ログレス性が保証されたメモリ管理方法および装置に関
する。BACKGROUND OF THE INVENTION With the advent of a processing system called Java, the importance of a language processing system having a garbage collection (hereinafter, referred to as GC as necessary) from the Internet to home appliances has been increasing. In such a language, the execution speed of the GC becomes a problem, and a GC with a short interruption time is required. The present invention relates to a memory management method and apparatus which is excellent in real-time performance and capable of performing GC with a short interruption time, and which guarantees progress.
【0002】[0002]
【従来の技術】ガーベージコレクション(以下GCとい
う)とは、記憶領域中に存在する、2度とアプリケーシ
ョンの処理対象とならないデータを決定し、そのデータ
が占有していた記憶領域を再利用可能にするための技術
である。まず、いくつかの技術用語を説明する。ユーザ
のアプリケーションをミューテータと呼ぶ。ミューテー
タがGC対象となるデータを作成、変更する。このよう
なデータをオブジェクトと呼ぶ。オブジェクトのうち、
2度とミューテータの処理対象とならないオブジェクト
をガーベージと呼ぶ。オブジェクトは他のオブジェクト
の参照を保持することができる。参照を保持する変数を
ポインタ変数という。2. Description of the Related Art Garbage collection (hereinafter referred to as GC) is to determine data existing in a storage area and not to be processed by an application again, and to make the storage area occupied by the data reusable. The technology to do. First, some technical terms will be described. The user's application is called a mutator. The mutator creates and changes data to be subjected to GC. Such data is called an object. Of the objects
Objects that are never processed by the mutator are called garbage. Objects can hold references to other objects. The variable that holds the reference is called the pointer variable.
【0003】従来から存在するGC方式として、トレイ
ン算法と呼ばれるものがある。これは、ミュテータの
実行を中断する時間が短く、中断時間をおおむね一定
時間に抑え、オブジェクトと参照からなる任意の構造
をGC対象とすることができるという特徴を持つ。トレ
イン算法は、2段階に構造化された記憶領域の分割管理
と、部分記憶領域間におけるオブジェクトの移動を利用
したGCである。以下上記した従来のGC処理について
説明する。トレイン算法においては、記憶領域を連続な
番地からなる固定サイズの記憶領域に分割したものをカ
ーと呼んでいる。オブジェクトは必ずいづれかのカーに
所属しなければならない。それゆえ、オブジェクトのと
り得る最大領域長は、カーの領域長によって定まる。カ
ーを要素とする集合をトレインと呼ぶ。トレインはシス
テム中に2つ以上用意されなければならない。さらに、
トレイン同士は必ず互いに疎、すなわち、「共通のカー
を持たない」でなければならない。As a conventional GC method, there is a method called a train algorithm. This is characterized in that the execution time of the mutator is interrupted for a short time, the interruption time is suppressed to a substantially fixed time, and an arbitrary structure including an object and a reference can be set as a GC target. The train algorithm is a GC that utilizes divided management of a storage area structured in two stages and movement of an object between partial storage areas. Hereinafter, the above-described conventional GC processing will be described. In the train algorithm, a car obtained by dividing a storage area into fixed-size storage areas consisting of continuous addresses is called a car. Objects must belong to one of the cars. Therefore, the maximum area length of the object is determined by the area length of the car. A set with cars as elements is called a train. Two or more trains must be provided in the system. further,
The trains must be sparse, that is, "do not have a common car."
【0004】図9に、カーとトレインで構成された記憶
領域の構成を示す。トレインには全順序が定められてお
り、各トレイン1〜mの順序数をトレイン番号という。
各トレイン1〜mの中のカーも順序付けされ、各カー1
〜nの順序数をカー番号という。あるトレイン中に含ま
れているカー番号は全て異なるが、トレインが異なれば
重複したカー番号を持つカーが存存してもかまわない。
その上で全トレインのカーは次のように順序付けされ
る。 同ートレイン内のカーの大小はカー番号から定ま
る。 異なったトレインに含まれるカーの大小はトレイン
番号から定まる。これを踏まえて、トレイン番号とカー
番号の組を大域カー番号と呼ぶ。大域カー番号は全順序
を持つ。FIG. 9 shows the configuration of a storage area composed of cars and trains. The total order of the trains is determined, and the order number of each of the trains 1 to m is called a train number.
The cars in each train 1-m are also ordered and each car 1
The ordinal number of n is called a car number. Although the car numbers included in a certain train are all different, cars having duplicate car numbers may exist if the trains are different.
Then the cars of all trains are ordered as follows. The size of the car in the train is determined by the car number. The size of the cars included in different trains is determined by the train number. Based on this, a set of a train number and a car number is called a global car number. Global car numbers have a full order.
【0005】各カーにはリメンバー集合と呼ばれるポイ
ンタ変数の集合が定義される。リメンバー集合の要素
は、このカーに存在するオブジェクトを参照する、より
大きい大域カー番号を持つ他のカー上の記憶番地か、ま
たは、ルートの記憶番地を記録している。参照とリメン
バー集合のポインタ変数との関係を図10に示す。同図
に示すように、カー1にはリメンバー集合1が定義され
る。ここで、カー1より大きい大域カー番号を持つカー
kのオブジェクトkがカー1のオブジェクト1を参照し
ている(カーkのオブジェクトkのポインタ変数が、カ
ー1のオブジェクト1を指している)とすると、リメン
バー集合1の要素(ポインタ変数1)には、上記カーk
のオブジェクトkの記憶番地が記憶される。また、上記
カー1のオブジェクト1がルートから参照されている場
合には、リメンバー集合1の要素1にルートの記憶番地
が記録される。A set of pointer variables called a remember set is defined for each car. The element of the member set records a storage address on another car having a higher global car number or a storage address of a root, which refers to an object existing in this car. FIG. 10 shows the relationship between the reference and the pointer variable of the member set. As shown in the drawing, a car 1 defines a member set 1. Here, it is assumed that the object k of the car k having the global car number larger than the car 1 refers to the object 1 of the car 1 (the pointer variable of the object k of the car k points to the object 1 of the car 1). Then, the element of the member set 1 (pointer variable 1) contains the car k
The storage address of the object k is stored. When the object 1 of the car 1 is referred to from the route, the storage address of the route is recorded in the element 1 of the member set 1.
【0006】トレイン算法は、上記したカー、トレイ
ン、リメンバー集合を用いて次のようにGC処理を実施
する。なお、GC処理はミューテータの実行中に繰り返
し実施されるものである。 1)ミューテータの実行を全GC処理にわたって中断す
る。 2)最小トレインがルートかまたは他のトレインから参照
されているかどうか検査する。誰からも指されていない
ならば、最小トレイン中の全てのカーと最小トレインそ
のものを再利用の対象として回収し、後述する手順7)に
進む、一方どこからか参照されている場合には以下の手
順に進む。 3)最小カーのリメンバー集合を走査し、(a)ルートから
参照されているオブジェクトを最小のトレインを除いた
任意のトレインの任意のカーに複写する。また、(b) ル
ートから参照されておらず、他のカーから参照されてい
るオブジェクトを任意の参照元のカーか、又は参照元よ
りカー番号が大きいカーに複写する。複写の完了後、複
写元のオブジェクトを指すポインタ変数を全て複写先の
オブジェクトを指すように書き換える。その後、複写元
のオブジェクトが占めている記憶領域を回収する。これ
をオブジェクトの移動処理という。In the train algorithm, GC processing is performed as follows using the above-described car, train, and member set. Note that the GC process is repeatedly performed during execution of the mutator. 1) Suspend execution of the mutator over all GC processes. 2) Check if the minimum train is referenced by the root or another train. If not pointed to by anyone, collect all cars in the minimum train and the minimum train itself as a target for reuse, and proceed to step 7) described later, while if it is referenced from somewhere, the following Proceed to the procedure. 3) Scan the member set of the smallest car, and (a) copy the object referenced from the root to any car in any train except the smallest train. (B) Copy an object that is not referenced from the root but is referenced by another car to an arbitrary reference source car or a car having a car number higher than the reference source. After the copying is completed, the pointer variables pointing to the copy source object are all rewritten so as to point to the copy destination object. Then, the storage area occupied by the copy source object is collected. This is called object movement processing.
【0007】4)移動先のカーのリメンバー集合にこのオ
ブジェクトを指す他のカーにあるポインタ変数の格納番
地を追加して記録する。ただし、移動したオブジェクト
を指すポインタ変数が存在しているカーのカー番号が移
動先のカー番号よりも大きいものに限る。 5)最小カーに属する、移動したオブジェクトから到達可
能な全てのオブジェクトを手順3)の(b) 適用して、それ
ぞれのカーに移動する。 6)以上によって、最小カーには移動できないオブジェク
トか、またはガーベージのみが残る。全てのオブジェク
トがガーベージになったならば、それらを回収した後
に、そのカーを最小トレインから回収する。また回収で
きない場合には、最小カーをそのまま残す。最小トレイ
ンに含まれるカーがまったく存存しないならば、最小ト
レインをトレイン全体の集合から取り除く。 7)ミューテータの実行を再開する。4) The storage address of a pointer variable in another car pointing to this object is added to the remember set of the destination car and recorded. However, the car number of the car in which the pointer variable pointing to the moved object exists is limited to the car number larger than the car number of the movement destination. 5) All the objects belonging to the smallest car and reachable from the moved object are applied to step (3) (b) and moved to each car. 6) As a result, only objects that cannot be moved to the smallest car or garbage remain. When all objects are garbage, after retrieving them, retrieve the car from the minimal train. If it cannot be collected, leave the smallest car as it is. If no cars are included in the minimum train, the minimum train is removed from the set of the entire train. 7) Resume execution of the mutator.
【0008】トレイン算法のGC処理を行なうために
は、ミューテータの処理の一部にトレイン算法のための
支援処理が必要である。これはライトバリア処理と呼ば
れている。ライトバリア処理とは、「ミューテータがオ
ブジェクトの参照をそのオブジェクトが所属しているカ
ーXと異なるカーYに格納するとき、かつ、カーYがカ
ーXよりも大きいときに限り、カーXのリメンバー集合
に、カーY上の記憶番地を保持するポインタ変数を追加
する」処理をいう。In order to perform the GC processing of the train algorithm, a support processing for the train algorithm is required as a part of the processing of the mutator. This is called a write barrier process. The write barrier processing is defined as “a mutator stores a reference to an object in a car Y different from the car X to which the object belongs, and only when the car Y is larger than the car X, A process of adding a pointer variable holding a storage address on the car Y to the set is referred to.
【0009】[0009]
【発明が解決しようとする課題】ガーベージが有限時間
内に回収できることは重要な要件であり、そのため、プ
ログレス性は重要である。ここで、プログレス性という
用語を次のように定める。GC処理によって、1つ以
上のガーベージが回収されるか、または、最小トレイ
ンから1つ以上のオブジェクトが移動したか、のいづれ
かが常に満たされるとき、プログレス性があるという。
すなわち、プログレス性があれば、最小トレインがいつ
か回収されることが保証される。これは任意のカーがい
つかGCの対象となるということと同義である。GC方
式にとって、ガーベージが有限時間内に回収できること
は重要な要件である。It is an important requirement that the garbage can be collected within a finite time, and therefore the progress is important. Here, the term "progressiveness" is defined as follows. Progress is said to occur when one or more garbage is collected by the GC process, or one or more objects have moved from the minimum train.
That is, if there is progress, it is guaranteed that the minimum train will be collected someday. This is synonymous with that any car will be subject to GC someday. It is an important requirement for the GC system that garbage can be collected within a finite time.
【0010】前記したトレイン算法の抱える問題点を列
挙すると次のようになる。 1)プログレス性が保証できないので、ガーベージを有
限時間内に回収する保証がない。プログレス性が保証で
きないのは次のような状況において生ずる。 最小カーにガーベージが1つもなく、全てのオブジェ
クトは移動できない状況においては、最小カーは回収で
きないためにプログレス性がなくなる。図11にその例
を示す。同図に示すように、最小カーN0のオブジェク
トが移動不可の場合には、最小カーは回収できない。 次の2条件を双方満たすような状況においてはプログ
レス性が保証できない。 ・最小カーを含む複数のカーに跨がった、サイクリック
なオブジェクト構造が存在し、このオブジェクト構造全
体で必要とする記憶領域はカーのサイズよりも大きい。 ・そのオブジェクト構造は、他のトレイン中のオブジェ
クトから指されておらず、最小カー以外のカーにおいて
ルートから参照されている。The problems with the above-described train algorithm are listed below. 1) Since progress cannot be guaranteed, there is no guarantee that garbage will be collected within a finite time. Progress cannot be guaranteed in the following situations. In a situation in which there is no garbage in the smallest car and all objects cannot be moved, the progress is lost because the smallest car cannot be collected. FIG. 11 shows an example. As shown in the figure, when the object of the minimum car N0 cannot be moved, the minimum car cannot be collected. In a situation where both of the following two conditions are satisfied, progress cannot be guaranteed. There is a cyclic object structure extending over a plurality of cars including the smallest car, and the storage area required for the entire object structure is larger than the size of the car. -The object structure is not pointed to by other objects in the train, but is referenced from the root in a car other than the smallest car.
【0011】図12にその例を示す。同図に示すように
最小カー1のオブジェクト1がカーkのオブジェクトk
から参照されており、オブジェクト1はカーkのオブジ
ェクトk1を参照しているサイクリックな構造が存在
し、このオブジェクト構造において、オブジェクトkは
他のトレインから参照されておらず、ルートから参照さ
れている場合であって、上記したようにこのオブジェク
ト構造全体で必要とする記憶領域がカーのサイズよりも
大きい場合には、最小カーは回収できないためプログレ
ス性を保証することはできない。。FIG. 12 shows an example. As shown in the figure, the object 1 of the smallest car 1 is the object k of the car k
And the object 1 has a cyclic structure in which the object k refers to the object k1 of the car k. In this object structure, the object k is not referred to from other trains but is referred to from the root. If the storage area required for the entire object structure is larger than the size of the car as described above, the progress of the car cannot be guaranteed because the smallest car cannot be collected. .
【0012】2)リメンバー集合の大きさをあらかじめ
束縛することが困難である。例えば、図13に示すよう
に、あるオブジェクトを指す他のカー中のポインタ変数
が多数存在するとき、これを記録するためのリメンバー
集合は非常に大きなものになる。この場合には次のよう
な不具合が生じる。 リメンバー集合を記録する領域が増大する。 オブジェクトを移動したときのリメンバー集合に記録
されたポインタ変数の更新にかかる時間はポインタ変数
の数に比例し、予め定められた中断時間以内にGC処理
を終了する保証ができない。2) It is difficult to restrict the size of the member set in advance. For example, as shown in FIG. 13, when there are a large number of pointer variables in another car pointing to a certain object, the member set for recording the variables becomes very large. In this case, the following problem occurs. The area for recording the member set increases. The time required for updating the pointer variables recorded in the member set when the object is moved is proportional to the number of pointer variables, and it cannot be guaranteed that the GC processing will be completed within a predetermined interruption time.
【0013】3)ガーベージがカーを跨ぐ参照の構造を
なす時、その構造に含まれるオブジェクトの最大のカー
番号がGC対象になるまでは、確実にガーベージを回収
することができない。そのため、ガーベージを複写する
という無駄な仕事が生じうる。図14はその例であり、
最小カー1のオブジェクト1がカーkのオブジェクトに
より参照され、カーkのオブジェクトkがカーmのオブ
ジェクトに参照されるようにカーを跨ぐ参照の構造の場
合、最大のカー番号mがGC対象になるまでは、確実に
ガーベージを回収することができない。 4)例えば、図15に示すように、カーに収まり切らな
いようなサイズのオブジェクトはトレイン算法では扱え
ない。本発明は上記した従来技術の問題点を解決するた
めになされたものであって、その目的とするところは、
予め定められた時間内に確実にGCを完了させることが
できる実時間性に優れ、プログレス性が保証されたメモ
リ管理方法および装置を提供することである。3) When garbage forms a reference structure that crosses cars, garbage cannot be reliably collected until the maximum car number of an object included in the structure becomes a GC target. Therefore, useless work of copying garbage may occur. FIG. 14 is an example,
In the case of a reference structure that crosses cars so that the object 1 of the smallest car 1 is referenced by the object of the car k and the object k of the car k is referenced by the object of the car m, the largest car number m becomes a GC target. Until, garbage cannot be collected reliably. 4) For example, as shown in FIG. 15, an object having a size that does not fit in a car cannot be handled by the train algorithm. The present invention has been made in order to solve the above-described problems of the related art, and the object thereof is to:
An object of the present invention is to provide a memory management method and apparatus which is excellent in real-time performance and can ensure progress, which can surely complete GC within a predetermined time.
【0014】[0014]
【課題を解決するための手段】図1は本発明の概要を示
す図である。同図(b)に示すように、本発明において
は、記憶領域をカー、トレイン管理用領域1と、オブジ
ェクト用記憶領域2と、ハンドルを記憶するための領域
3に分割し、オブジェクト本体を上記オブジェクト用記
憶領域2に格納し、上記ハンドルを記憶するための領域
3にオブジェクトを参照するハンドルを記憶し、該ハン
ドルにそのハンドルを参照しているオブジェクトが所属
するカーの内の最大の大域カー番号を記録する。また、
カー、トレイン管理用領域1において各ハンドルとカ
ー、トレインを対応付ける。そして、ガーベージコレク
ション(GC)に際しては、同図(a)に示すように以
下の処理を行う。 (a) 最小トレインに所属するハンドルの参照元から、ガ
ーベージとして回収しないオブジェクトを参照するハン
ドル集合を求め、ガーベージとして回収しないオブジェ
クトにマーク処理もしくは移動処理のいずれかの処理を
割り当てる。 (b) 上記ハンドル集合に属するハンドルを、参照元最大
カー番号以上を満たすカーに移動し、移動処理が割り当
てられたオブジェクトを、オブジェクトの領域長以上の
未使用記憶領域に移動させ、マーク処理が割り当てられ
てたオブジェクトにマークをつける。 (c) マークされていないオブジェクトをガーベージとし
て回収し、最小トレインからカー、トレインを回収す
る。本発明においては、上記のようにGC処理を行って
いるので、予め定められた中断時間内に常にGCを完了
させることができ、GCは常に1つ以上のカーの削除を
実施することができる。そのため、実時間性に優れ、プ
ログレス性を保証することができる。FIG. 1 is a diagram showing an outline of the present invention. As shown in FIG. 1B, in the present invention, the storage area is divided into a car / train management area 1, an object storage area 2, and an area 3 for storing a handle, and the object body is divided into the above. An object 3 is stored in the object storage area 2, a handle for referring to the object is stored in the area 3 for storing the handle, and the largest global car among the cars to which the object referring to the handle belongs is stored in the handle. Record the number. Also,
In the car / train management area 1, each handle is associated with a car and a train. Then, at the time of garbage collection (GC), the following processing is performed as shown in FIG. (a) A handle set that refers to an object that is not collected as garbage is obtained from a reference source of a handle belonging to the minimum train, and one of mark processing and moving processing is assigned to the object that is not collected as garbage. (b) The handle belonging to the above handle set is moved to a car that satisfies the reference source maximum car number or more, and the object to which the movement processing is assigned is moved to an unused storage area equal to or longer than the area length of the object. Mark assigned objects. (c) Collect unmarked objects as garbage, and collect cars and trains from the smallest train. In the present invention, since the GC processing is performed as described above, the GC can be always completed within a predetermined interruption time, and the GC can always delete one or more cars. . Therefore, the real-time property is excellent, and the progress property can be guaranteed.
【0015】また、本発明は次のように構成することも
できる。 (1)予め定められたミューテータの中断時間を越えな
いような制約の基に、上記マーク処理と移動処理の割り
当てを行う。 (2)マーク処理もしくは移動処理のいずれかの処理を
割り当てるに際し、ルートから参照されているオブジェ
クトに対するマーク又は移動処理を割り当てる処理A
と、最小トレインからn個のカーを選択し該選択された
カーのオブジェクトに対してマークまたは移動処理を割
り当てる処理Bと、処理Aおよび処理Bを、予め定めら
れたミューテータの中断時間に応じて選択的に行う。The present invention can also be configured as follows. (1) The assignment of the mark processing and the movement processing is performed based on a restriction not to exceed a predetermined interruption time of the mutator. (2) When assigning either the mark processing or the movement processing, the processing A for assigning the mark or the movement processing to the object referenced from the root
And a process B of selecting n cars from the minimum train and assigning a mark or a movement process to an object of the selected car, and a process A and a process B according to a predetermined interruption time of the mutator. Perform selectively.
【0016】[0016]
【発明の実施の形態】以下本発明の実施の形態について
説明する。本発明のGC処理は、以下のようなミューテ
ータの実行環境を前提としている。 全てのオブジェクトは間接参照を用いて書き換え、
読み出し処理を行なう。ミューテータのポインタ変数に
オブジェクトへの直接参照は存在しない。以下の説明で
は間接参照をハンドルと称している。前記したリメンバ
ー集合にはそのカーに所属するオブジェクトのハンドル
を登録する。ハンドルとオブジェクトの関係は図2に示
すようになる。すなわち、同図(a)に示すようにカ
ー、トレインを管理するための記憶領域とオブジェクト
本体を格納するための記憶領域と、ハンドルを記憶する
ための領域を設け、ハンドルを介してオブジェクトを参
照する。また、従来で説明したようにカーの中に物理的
にオブジェクトを持たない。ハンドルは、同図(b)に
示すように自オブジェクトのアドレスとカー、トレイン
番号(自オブジェクトを参照しているオブジェクトが参
照している最大のカー、トレイン番号)を持ち、各オブ
ジェクトのポインタがハンドルを指す。ハンドルのアド
レスは移動してもかまわない。その場合には、上記管理
領域上の情報を書き換える。前記したミューテータによ
るライトバリア処理時には、ハンドルのカー/トレイン
番号を書き換える。Embodiments of the present invention will be described below. The GC processing of the present invention is based on the following mutator execution environment. All objects are rewritten using indirect references,
A read process is performed. There is no direct reference to the object in the mutator pointer variable. In the following description, an indirect reference is called a handle. The handle of the object belonging to the car is registered in the aforementioned member set. The relationship between the handle and the object is as shown in FIG. That is, as shown in FIG. 1A, a storage area for managing a car and a train, a storage area for storing an object body, and an area for storing a handle are provided, and an object is referenced via the handle. I do. Also, as described above, there is no physical object in the car. The handle has the address of the own object, the car, and the train number (the largest car and train number referred to by the object referencing the own object) as shown in FIG. Point to the handle. The handle address can be moved. In that case, the information in the management area is rewritten. During the write barrier processing by the mutator, the car / train number of the handle is rewritten.
【0017】 現在処理中のオブジェクトは移動でき
ない場合がある。 領域長の大きなオブジェクトと小さいオブジェクト
が混在している。 許容できる中断時間は実行前に決められており、そ
の中断時間以内に必ずGC処理が終ることを要請する。An object currently being processed may not be able to move. Objects with large and small area lengths are mixed. The allowable interruption time is determined before execution, and it is requested that the GC process is always completed within the interruption time.
【0018】本実施例において、ミューテータは実行中
に以下のGCに対する支援処理を行う。 リメンバー集合の構成 リメンバー集合には、参照元ポインタ変数の番地ではな
く、上記したようにそのカーに所属するオブジェクトの
ハンドルを登録する。登録されたハンドルには、そのハ
ンドルを参照しているオブジェクトが所属するカーのう
ちの最大の大域カー番号を記録する。ハンドルに記録さ
れたカー番号を参照元最大カー番号と称する。 ライトバリア処理 オブジェクトに他のオブジェクトを指すハンドルの参照
を格納するとき、ハンドルの参照元最大大域カー番号
が、オブジェクトの属するカーの大域カー番号よりも小
さいならば、ハンドルの参照元最大大域カー番号の属す
るカーの大域カー番号以上のカー番号に設定する。In this embodiment, the mutator performs the following GC support processing during execution. Structure of Remember Set In the remember set, the handle of the object belonging to the car is registered as described above, instead of the address of the reference pointer variable. In the registered handle, the largest global car number among the cars to which the object referring to the handle belongs is recorded. The car number recorded on the handle is referred to as a reference source maximum car number. Write barrier processing When storing a reference to a handle pointing to another object in an object, if the reference global car number of the handle is smaller than the global car number of the car to which the object belongs, the reference global car number of the handle is Set to a car number higher than the global car number of the car to which
【0019】図3、図4に本実施例のGC処理手順を示
す。以下、図3、図4を参照しながら本実施例のGC処
理について説明する。なお、以下の説明において、手順
3)[処理A]と手順4)[処理B]は順不同であり、
これらの手順に現れるnとcは、〔処理A〕と〔処理
B〕から推定される仕事に費やす総時間の上限が中断時
間より小さくなるように定める。また、以下のステップ
S1,S2,…は図3、図4に付したステップ番号であ
る。また、従来のルートに加え、ここでは、最小でない
トレインから最小のトレイン内への参照を総じて「疑似
ルート」と定義し、また、集合としての意味を強調する
ときは「疑似ルート集合」という。 1)GC処理の開始と同時に、ミューテータの実行を中
断する(図3のステップS1)。 2)最小トレインがルートかまたは他のトレインから参
照されているか(疑似ルートから参照されているか)ど
うか検査する(ステップS2)。誰からも指されていな
いならば、最小トレイン中の全てのカーと最小トレイン
そのものを再利用の対象として回収し(ステップS
3)、後述する手順10)(ステップS11)に進む、
一方どこからか参照されている場合には以下の手順に進
む。FIGS. 3 and 4 show the GC processing procedure of this embodiment. Hereinafter, the GC processing of this embodiment will be described with reference to FIGS. In the following description, procedure 3) [Process A] and procedure 4) [Process B] are in no particular order.
N and c appearing in these procedures are determined so that the upper limit of the total time spent on the work estimated from [Process A] and [Process B] is smaller than the interruption time. Further, the following steps S1, S2,... Are the step numbers assigned to FIG. 3 and FIG. Further, in addition to the conventional route, a reference from a non-minimum train to a minimum train is generally defined as a “pseudo route”, and when emphasizing the meaning as a set, it is referred to as a “pseudo route set”. 1) Simultaneously with the start of the GC processing, the execution of the mutator is interrupted (step S1 in FIG. 3). 2) It is checked whether the minimum train is referred to from the root or another train (whether the minimum train is referred to from a pseudo route) (step S2). If not pointed out by anybody, all cars in the minimum train and the minimum train itself are collected for reuse (step S).
3), proceed to the procedure 10) (step S11) described later,
On the other hand, if it is referenced from somewhere, the procedure proceeds to the following procedure.
【0020】3)疑似ルートから参照されたオブジェク
トに対する処理の割り当てを行なう。これを処理Aとい
う。 (a)最小トレインに所属する、疑似ルートから参照さ
れているハンドル集合の空でない部分集合Cを定める
(ステップS4)。Cは実際ルートから参照されている
ハンドルを1つ以上含むものであればよい。 (b)Cから参照されている全オブジェクトにマーク処
理または移動処理のいずれの処理を行なうかの割り当て
を行なう(ステップS5)。例えば、図5に示すように
最小トレインのカー1,2のハンドルH1,H2,H3
がルートR1、ルートR2(これは疑似ルートであって
もなくてもよい)から参照されている場合には、同図に
示すように部分集合Cを定め、該部分集合Cから参照さ
れているオブジェクトOb1,Ob2,Ob3に「移動
処理」あるいは「マーク処理」のいずれの処理を行うか
の割り当てを行う。「移動処理」あるいは「マーク処
理」のいずれの処理が割り当てられたオブジェクトはガ
ーベージとして回収されないが、「移動処理」が割り当
てられたオブジェクトは後述するようにオブジェクトの
領域長以上を持つ未使用記憶領域に移動される。なお、
「移動処理」と「マーク処理」の比率は自由に選ぶこと
ができ、マーク処理は、移動処理に比べて仕事量が少な
いので、マーク処理を優先すれば、最小カーを含めた複
数のカーをGCの対象とすることができる。3) Allocate a process to the object referenced from the pseudo root. This is called process A. (A) A non-empty subset C of the handle set belonging to the minimum train and referred to by the pseudo route is determined (step S4). C only needs to include at least one handle referred to from the actual route. (B) Assignment is performed to all objects referenced by C, whether to perform a mark process or a move process (step S5). For example, as shown in FIG. 5, the handles H1, H2, H3 of the cars 1 and 2 of the smallest train.
Is referred to from the root R1 and the root R2 (which may or may not be a pseudo root), a subset C is determined as shown in FIG. Assignment is made to the objects Ob1, Ob2, and Ob3 as to which of “movement processing” and “mark processing” is to be performed. An object to which either “move processing” or “mark processing” is assigned is not collected as garbage, but an object to which “move processing” is assigned is an unused storage area having an object area length or more as described later. Moved to In addition,
The ratio between "move processing" and "mark processing" can be freely selected. Mark processing requires less work than moving processing, so if priority is given to mark processing, multiple cars including the smallest car can be used. Can be subject to GC.
【0021】4)最小トレインから(n+1)個のカー
を選択し、全オブジェクトに対する処理の割り当てを行
なう。これを〔処理B〕という。 (a)最小トレインから、最小カーから始まる(n+
1)個のカー、すなわちカー番号NoからNnまでのカ
ーを選択する(ステップS6)。ただし、nは0以上の
整数である。 (b)NoからNnまでのカーのリメンバー集合の和集
合から、Nnよりも大きいカーからの間接参照を全て集
める。この集合をRとする(ステップS7)。 (c)NoからNnでのカーに存在する全てのオブジェ
クトに、マーク処理または移動処理のいずれの処理を行
なうかの割り当てを行なう(ステップS8)。例えば、
図6に示すように最小トレインに属するカーからカー
1、カー2、カー3を選択する。そして、カー1〜3の
リメンバー集合の和集合から、3よりも大きいカーから
の間接参照を集めて、同図に示すように和集合Rとす
る。ついで、カー1、カー2、カー3に存在する全ての
オブジェクトOb1〜Ob4に「移動処理」あるいは
「マーク処理」のいずれの処理を行うかの割り当てを行
う。4) (n + 1) cars are selected from the minimum train, and processing is assigned to all objects. This is called [Processing B]. (A) From the smallest train, starting from the smallest car (n +
1) Cars, that is, cars with car numbers No to Nn are selected (step S6). Here, n is an integer of 0 or more. (B) Collect all indirect references from cars larger than Nn from the union of the remembered sets of cars from No to Nn. This set is defined as R (step S7). (C) Assignment is performed to all objects existing in the car from No to Nn to perform either the mark processing or the movement processing (step S8). For example,
As shown in FIG. 6, car 1, car 2, and car 3 are selected from the cars belonging to the minimum train. Then, indirect references from the cars larger than 3 are collected from the union of the remembered sets of the cars 1 to 3, and are set as the union R as shown in FIG. Then, an assignment is made to all the objects Ob1 to Ob4 existing in the car 1, the car 2 and the car 3 as to which of the "moving processing" and the "marking processing" is to be performed.
【0022】5)上記R(Nnよりも大きいカーからの
間接参照の集合)とC(ルートから参照されているハン
ドル集合)の和集合Mを求め、参照関係による、Mから
の到達可能性に基づき、カー番号NoからNnのいづれ
かのカーに所属するハンドルからなる推移閉包集合Tを
求める。ここで、「Mからの到達可能性」はMから参照
関係でつながっているものを意味し、上記「推移閉包集
合T」はMから参照関係をたどったとき、Mと参照関係
のあるものでNoからNnまでのカーに属するハンドル
の集合となる。これらはガーベージの対象とならない。5) Find the union M of R (a set of indirect references from cars larger than Nn) and C (a set of handles referenced from the root), and determine the reachability from M by the reference relationship. Based on this, a transitive closure set T composed of handles belonging to any of the cars No. to Nn is obtained. Here, “reachability from M” means a connection from M by a reference relationship, and the “transitive closure set T” has a reference relationship with M when following the reference relationship from M. A set of handles belonging to cars No. to Nn. They are not subject to garbage.
【0023】6)推移閉包集合Tに含まれるハンドルを
参照元最大カー番号以上を満たすカーに移動する(ステ
ップS9)。すなわち、ハンドルのカー、トレイン番号
から最大のカー、トレイン番号を分かるのでこれを利用
して、参照元最大カー番号を求め、ガーベージ対象とな
らないハンドル(推移閉包集合Tに含まれるハンドル)
を参照元最大カー番号以上へ移動する。ただし、このハ
ンドルがルートから参照されており、かつ、参照元最大
カー番号で指定されるカーが最小トレインに所属する場
合に限り、最小トレイン以外の任意のトレインの任意の
カーにハンドルを移動する。なお、ハンドルを移動させ
てもオブジェクト自体は移動しないが、ハンドルの参照
先のオブジェクトは変わらないので、論理的には他のカ
ー、トレインにオブジェクトを移動させていることにな
る。ハンドルの移動後、このハンドルによって参照され
るオブジェクトが保持するポインタ変数に前記した推移
閉包集合Tの要素(ハンドル)があれば、その要素の参
照元最大カー番号を必要に応じて更新する。これは、参
照元最大カー番号に現状を反映させるための処理であ
る。以上の処理をTに含まれている全ハンドルに適用す
る。6) The handle included in the transitive closure set T is moved to a car satisfying the reference source maximum car number or more (step S9). That is, since the maximum car and train number can be obtained from the car and the train number of the handle, the maximum car number of the reference source is obtained by using this, and the handle that is not a garbage target (the handle included in the transitive closure set T)
To the reference source maximum car number or higher. However, only when this handle is referenced from the route and the car specified by the reference source maximum car number belongs to the minimum train, the handle is moved to any car in any train other than the minimum train . Even if the handle is moved, the object itself does not move, but the object referred to by the handle does not change. Therefore, the object is logically moved to another car or train. After the handle is moved, if the pointer variable held by the object referenced by the handle includes an element (handle) of the transitive closure set T, the reference source maximum car number of the element is updated as necessary. This is a process for reflecting the current state in the reference source maximum car number. The above processing is applied to all the handles included in T.
【0024】7)移動したハンドルから参照されたオブ
ジェクトが「マーク処理」のみを実施するよう定まって
おれば、オブジェクトにマークを設定する。一方、オブ
ジェクトが移動するように定められているならば、前記
したように該オブジェクトを、オブジェクトの領域長以
上を持つ未使用記憶領域に移動する。オブジェクトを移
動させることにより記憶領域上にまとまった領域を確保
できるようになる。 8)カー番号NoからNnのカーに残されたオブジェク
トのうち、マークされていないものをガーベージと決定
し回収する。 9)カー番号NoからNnを最小トレインから取り除
く。最小トレインに含まれるカーがまったく存在しない
ならば、最小トレインをトレイン全体の集合から取り除
く(ステップS10)。 10)ミューテータの実行を再開する(ステップS1
1)。7) If the object referred to by the moved handle is determined to perform only the "mark processing", a mark is set on the object. On the other hand, if the object is set to move, the object is moved to an unused storage area having a length equal to or longer than the area length of the object as described above. By moving the object, it becomes possible to secure an integrated area on the storage area. 8) Of the objects left in the cars No. N to Nn, unmarked objects are determined as garbage and collected. 9) Remove Nn from car number No from the minimum train. If there is no car included in the minimum train, the minimum train is removed from the entire set of trains (step S10). 10) Restart the execution of the mutator (step S1)
1).
【0025】以上説明したGC処理は、従来例に比べ次
のような利点があり最小トレインがいつか回収されるこ
とが保証される。すなわち、プログレス性を保証するこ
とができる。 リメンバー集合に間接参照であるハンドルを登録し
ているので、同一のオブジェクトへの多数の参照に対す
るリメンバー集合中の要素を唯一にすることができる。
すなわち、オブジェクトを多くのオブジェクトが参照し
ている場合でも、従来例で説明したようにリメンバー集
合に複数のポインタ変数を持つ必要がなく、リメンバー
集合中の要素としては唯一のハンドルでよい。このた
め、あるカーのリメンバー集合は、そのカーに所属する
オブジェクトの数を越えることがないと保証できる。こ
れにより、リメンバー集合の巨大化による、必要領域と
走査時間の増大を避けることが可能になる。さらに、多
数のポインタ変数から参照されているオブジェクトを特
別扱いする必要がない。The above-described GC processing has the following advantages over the conventional example, and guarantees that the minimum train will be collected someday. That is, progress can be guaranteed. Since a handle that is an indirect reference is registered in the member set, the element in the member set for multiple references to the same object can be made unique.
That is, even when many objects refer to an object, it is not necessary to have a plurality of pointer variables in the member set as described in the conventional example, and only one handle may be used as an element in the member set. For this reason, it can be guaranteed that the remember set of a car does not exceed the number of objects belonging to the car. As a result, it is possible to avoid an increase in the required area and the scanning time due to the enlargement of the member set. In addition, there is no need to specially handle objects referenced by many pointer variables.
【0026】 オブジェクトは物理的にカーの中に存
在しないので、オブジェクトが記憶領域中のどこに存在
するか考慮する必要がない。このため、オブジェクトの
移動がGC処理に必須な処理でなくなっている。すなわ
ち、移動が許されないオブジェクトはそのままに、移動
が可能なオブジェクトは未使用領域に移動するというよ
うに、柔軟にオブジェクトの移動を実施できる。巨大な
オブジェクトについては常に移動しないように決めてお
くことで、小さいオブジェクトと同じ取り扱いができ
る。 カーに所属するオブジェクトの中からガーベージを
選別する処理をオブジェクトの移動ないしオブジェクト
のマークを用いて行っている。このため、あらかじめ定
められた中断時間を越えることなく、マーク処理と移動
処理の比率を自由に選ぶことができる。一般に、マーク
処理は、移動処理に比べて仕事量が少ないので、マーク
処理を優先すれば、最小カーを含めた複数のカーをGC
対象とすることができる。この結果、GCによって見つ
かるガーベージが増加し、それらを無駄に移動させない
ことを実現する。また、GC処理が終った時は、最小カ
ーを含む連続したカー番号の領域にミューテータが読み
書き可能なハンドルは一切残らない。このため、1回の
GC処理で1つ以上のカーを常に削除することが可能で
ある。また、ルートから参照されているオブジェクトの
うち、少なくとも1つのオブジェクトは、マーク処理ま
たは移動処理で他のトレインに所属するようになる。Since the object does not physically exist in the car, it is not necessary to consider where the object exists in the storage area. Therefore, the movement of the object is not an essential process for the GC process. In other words, the object can be flexibly moved, for example, the object that is not allowed to move and the movable object moves to an unused area. By deciding not to move a large object at all times, the same handling as a small object can be performed. The process of selecting garbage from the objects belonging to the car is performed using the movement of the object or the mark of the object. Therefore, the ratio between the mark processing and the movement processing can be freely selected without exceeding a predetermined interruption time. In general, the mark processing requires a smaller amount of work than the movement processing.
Can be targeted. As a result, the garbage found by the GC increases, and it is realized that they are not moved wastefully. When the GC process is completed, no mutator readable / writable handle remains in the area of consecutive car numbers including the minimum car. Therefore, it is possible to always delete one or more cars by one GC process. At least one of the objects referenced from the root belongs to another train by the mark processing or the movement processing.
【0027】次に、上記GC処理を行うメモリ管理装置
の構成例について説明する。図7は本実施例のメモリ管
理装置の全体構成を示す図、図8は図7におけるオブジ
ェクトのマーク移動処理の連続実行装置の詳細構成を示
す図である。同図において、矢印は情報の流れ、矩形が
囲まれた部分は処理手段、楕円で囲まれた部分は情報、
データを示す。図7、図8に示すメモリ管理装置は、C
PUとメモリと外部記憶装置と入出力装置等を有する通
常の計算機システムで実現することができ、上記外部記
憶装置等に本実施例のGC処理を行うプログラム等が格
納され、実行時、該プログラムが上記メモリに読み込ま
れ、GC処理が行われる。図7に示すように、本実施例
のメモリ管理装置は4つの要素から構成される。同図に
おいて、処理疑似ルート選択手段11は、疑似ルートか
ら指された全ハンドルの集合から、処理対象となる疑似
ルートから指されたハンドルの部分集合を出力する。Next, an example of the configuration of a memory management device that performs the above-described GC processing will be described. FIG. 7 is a diagram showing the overall configuration of the memory management device of the present embodiment, and FIG. 8 is a diagram showing the detailed configuration of a continuous execution device for the object mark moving process in FIG. In the figure, the arrow indicates the flow of information, the portion surrounded by a rectangle is processing means, the portion surrounded by an ellipse is information,
Show data. The memory management device shown in FIGS.
It can be realized by a normal computer system having a PU, a memory, an external storage device, an input / output device, and the like. A program for performing the GC processing of the present embodiment is stored in the external storage device and the like. Is read into the memory, and the GC process is performed. As shown in FIG. 7, the memory management device of the present embodiment is composed of four elements. In the figure, the processing pseudo route selection means 11 outputs a subset of handles pointed from the pseudo route to be processed from the set of all handles pointed from the pseudo route.
【0028】オブジェクトのマーク移動処理の割り当て
手段12は、アプリオリに与えられたミューテータの中
断時間の制約、最小カーに所属する(管理される)全ハ
ンドルの集合、および、疑似ルートの部分集合から処理
対象となるオブジェクトの全てに対して、マーク、移動
処理の割り当てを行う。また、この手段12は処理ルー
ト選択手段11に対して、ハンドルの追加要求をするこ
とができる。オブジェクトのマーク移動処理の連続実行
手段13は、図8によりさらに詳細に説明するが、上記
最小カーのリメンバ集合、各オブジェクトへのマーク、
移動処理割り当て、および、疑似ルートの部分集合を読
み込み、各オブジェクトに対して、前記したようにマー
ク、移動処理を実施する。上記連続実行手段13におけ
る処理が完了したら、上記連続実行手段13は、完了通
知をカー、トレインの削除手段14に送信する。カー、
トレインの削除手段14は、上記完了通知を受信する
と、最小カーを削除する。その上で最小トレインの中に
一つもカーが存在しなければ、引き続き、最小トレイン
を削除する。The assigning means 12 for the object mark moving process performs processing based on the restriction of the mutator interruption time given a priori, a set of all handles belonging (managed) belonging to the smallest car, and a subset of the pseudo route. A mark and a movement process are assigned to all the target objects. Further, this means 12 can request the processing route selecting means 11 to add a handle. The object mark moving process continuous execution means 13 will be described in more detail with reference to FIG.
The movement processing assignment and the subset of the pseudo route are read, and the marking and movement processing are performed on each object as described above. When the processing in the continuous execution means 13 is completed, the continuous execution means 13 transmits a completion notification to the car and train deletion means 14. car,
Upon receiving the completion notification, the train deletion unit 14 deletes the minimum car. If there is no car in the minimum train, the minimum train is continuously deleted.
【0029】オブジェクトのマーク移動処理の連続実行
手段13は図8に示すように、5つの要素から構成され
る。マージャ21は最小カーのリメンバ集合とルートの
部分集合を読み込んで、それらの和集合を出力する。出
力された和集合は、操作ハンドルの初期値となる。ハン
ドルの読み込み手段22は、操作ハンドルの集合から1
つのハンドルを読み込み、そのハンドルに記述されたハ
ンドル情報と、そのハンドルから指されたオブジェクト
のオブジェクト情報を獲得する。As shown in FIG. 8, the continuous execution means 13 for the object mark moving process is composed of five elements. The merger 21 reads the minimum car remember set and the root subset, and outputs the union of them. The output union becomes the initial value of the operation handle. The handle reading means 22 reads 1 from the set of operation handles.
One handle is read, and the handle information described in the handle and the object information of the object pointed to by the handle are obtained.
【0030】上記ハンドル情報は、所属大域カー番号と
参照元大域カー番号の更新手段23に送られる。所属大
域カー番号と参照元大域カー番号の更新手段23は、こ
のハンドルが移動するのに適切なカーを探索し、そのハ
ンドルの所属大域カー番号と参照元大域カー番号の情報
を更新する。オブジェクトの移動・マーク処理手段24
は、オブジェクトの情報と、そのオブジェクトの、各オ
ブジェクトへのマークのマーク、移動の割り当てを読み
込んで、実際にオブジェクトのマークないし移動処理を
実行する。オブジェクト内部のポインタ書き出し手段2
5は、オブジェクト情報からそのそのオブジェクト内部
に存在するポインタ変数に格納されたハンドルを、マー
ジャ21が出力する操作ハンドル集合に追加する。The above-mentioned handle information is sent to the updating unit 23 for the assigned global car number and the reference source global car number. The updating unit 23 of the belonging global car number and the reference source global car number searches for a car suitable for the handle to move, and updates information of the belonging global car number of the handle and the reference source global car number. Object movement / mark processing means 24
Reads the object information and the assignment of the mark and movement of the object to each object, and actually executes the mark or movement processing of the object. Pointer writing means 2 inside the object
5 adds a handle stored in a pointer variable existing inside the object from the object information to an operation handle set output by the merger 21.
【0031】次に本実施例のメモリ管理装置によるGC
処理について説明する。まず、前記図2に示したように
記憶領域をカー及びトレイン管理用の領域と、オブジェ
クト本体の格納のための領域と、ハンドルを記憶する領
域に分割する。図示しないミューテータが新たにオブジ
ェクトを生成するときは、そのオブジェクトの本体をオ
ブジェクト用の記憶領域中に割り当てる。また、そのオ
ブジェクトを参照するハンドルをハンドル用の記憶領域
に記憶させる。確保されたハンドルは任意のカーに記録
する。このとき、最小のカーを複数のカーに分割しても
よい。その後、このハンドルの記憶番地をミューテータ
の処理に渡す。最小のカーに含められるハンドル数の上
限は、この中の全てのオブジェクトにマーク処理を適用
するとして、予め定められた中断時間を越えない最大の
ハンドル数を求める、これを上限として、任意のハンド
ル数でGC処理を起動する。Next, the GC by the memory management device of this embodiment
The processing will be described. First, as shown in FIG. 2, the storage area is divided into an area for car and train management, an area for storing object bodies, and an area for storing handles. When a mutator (not shown) newly generates an object, the main body of the object is allocated in a storage area for the object. In addition, a handle that refers to the object is stored in a handle storage area. The secured handle will be recorded on any car. At this time, the smallest car may be divided into a plurality of cars. Thereafter, the storage address of the handle is passed to the mutator process. The upper limit of the number of handles that can be included in the smallest car is to determine the maximum number of handles that does not exceed a predetermined interruption time, assuming that mark processing is applied to all objects in this car. Trigger GC processing by number.
【0032】GC処理が始まると、前記したように処理
ルート選択手段11は、ルートから指された全ハンドル
の集合から、処理対象となるルートから指されたハンド
ルの部分集合を出力する。オブジェクトのマーク移動処
理の割り当て手段12は、ミューテータの中断時間の制
約、最小カーに所属する(管理される)全ハンドルの集
合、および、疑似ルートの部分集合から、処理対象とな
るオブジェクトの全てに対して、マーク、移動処理の割
り当てを行う。オブジェクトのマーク移動処理の連続実
行手段13は、上記図8に示したように、最小カーのリ
メンバ集合、各オブジェクトへのマーク、移動処理割り
当て、および、疑似ルートの部分集合を読み込み、各オ
ブジェクトに対して、前記したようにマーク、移動処理
を実施する。When the GC process starts, as described above, the processing route selection means 11 outputs a subset of the handles pointed to by the route to be processed from the set of all handles pointed to by the route. The assigning means 12 for the object mark moving process assigns all the objects to be processed from the constraints on the mutator interruption time, the set of all handles belonging to (managed by) the smallest car, and the subset of the pseudo route. On the other hand, a mark and a movement process are assigned. As shown in FIG. 8, the continuous execution means 13 of the mark moving process of the object reads the member set of the minimum car, the mark to each object, the allocation of the moving process, and the subset of the pseudo route, and On the other hand, the mark and move processing is performed as described above.
【0033】すなわち、前記図3、図4で説明したよう
に、ハンドルをそのハンドルに記録された参照元最大カ
ー番号以上となるカーに移動する。そのカーに登録可能
なハンドル数の上限(これは任意に定めてよい)を越え
る場合には、カー番号が1つ大きいカーにハンドルを登
録する。このハンドルから参照されているオブジェクト
に移動処理が割り当てられているならば、オブジェクト
用の領域にある未使用領域中にそのオブジェクトサイズ
分以上の領域を割り当てて、そこへオブジェクトを移動
する。GC処理が終了すると、カー、トレインの削除手
段14は、最小カーを削除し、最小トレインの中に一つ
もカーが存在しなければ、引き続き、最小トレインを削
除する。そして、オブジェクト用の領域に残ったガーベ
ージの占めていた領域を未使用領域として回収し再利用
する。That is, as described with reference to FIGS. 3 and 4, the handle is moved to a car having a reference source maximum car number or more recorded on the handle. If the upper limit of the number of handles that can be registered in the car is exceeded (this may be arbitrarily determined), the handle is registered in the car having the next larger car number. If movement processing has been assigned to the object referenced by this handle, an area equal to or larger than the object size is assigned to an unused area in the object area, and the object is moved there. When the GC processing is completed, the car / train deletion unit 14 deletes the minimum car, and if there is no car in the minimum train, the car and train deletion unit 14 continuously deletes the minimum train. Then, the area occupied by the garbage remaining in the object area is collected and reused as an unused area.
【0034】[0034]
【発明の効果】以上説明したように、本発明によれば以
下の効果を得ることができる。 (1)予め定められた中断時間内に常にGCを完了させ
ることができ、GCは常に1つ以上のカーの削除を実施
することができる。そのため、実時間性に優れ、プログ
レス性が保証される。 (2)同ーのオブジェクトへの多数の参照に対するリメ
ンバー集合中の要素を唯一にすることができる。このた
め、リメンバー集合の巨大化による、必要領域と走査時
間の増大を避けることが可能になる。 (3)移動が許されないオブジェクトはそのままに、移
動が可能なオブジェクトは未使用領域に移動するという
ように、柔軟にオブジェクトの移動を実施することがで
きる。 (4)カーに所属するオブジェクトの中からガーベージ
を選別する処理をオブジェクトの移動ないしオブジェク
トのマークを用いて行っているため、マーク処理と移動
処理の比率を適切に選ぶことにより、最小カーを含めた
複数のカーをGC対象とすることができる。この結果、
GCによって見つかるガーベージが増加し、それらを無
駄に移動させないことを実現することができる。As described above, according to the present invention, the following effects can be obtained. (1) The GC can always be completed within a predetermined interruption time, and the GC can always delete one or more cars. Therefore, the real-time property is excellent, and the progress property is guaranteed. (2) Only one element in the member set for multiple references to the same object can be made. For this reason, it is possible to avoid an increase in the required area and the scanning time due to the enlargement of the member set. (3) It is possible to flexibly move an object, for example, moving an object that is not allowed to move to an unused area while leaving an object that is not allowed to move. (4) Since the process of selecting garbage from the objects belonging to the car is performed using the movement of the object or the mark of the object, the ratio of the mark processing to the movement processing is appropriately selected to include the minimum car. A plurality of cars can be set as GC targets. As a result,
The garbage found by the GC increases and it can be realized that they are not moved wastefully.
【図1】本発明の概略を示す図である。FIG. 1 is a diagram showing an outline of the present invention.
【図2】本発明の実施例における記憶領域とオブジェク
トとハンドルの参照関係を説明する図である。FIG. 2 is a diagram illustrating a reference relationship among a storage area, an object, and a handle in the embodiment of the present invention.
【図3】本実施例のGC処理手順(1)を示す図であ
る。FIG. 3 is a diagram showing a GC processing procedure (1) of the embodiment.
【図4】本実施例のGC処理手順(2)を示す図であ
る。FIG. 4 is a diagram illustrating a GC processing procedure (2) of the present embodiment.
【図5】疑似ルートから参照されているハンドルの部分
集合Cを説明する図である。FIG. 5 is a diagram illustrating a subset C of handles referred to from a pseudo route.
【図6】NoからNnまでのカーのリメンバー集合の和
集合のうちNnよりも大きいカーからの間接参照の集合
Rを説明する図である。FIG. 6 is a diagram illustrating a set R of indirect references from a car larger than Nn in a union of remembered sets of cars from No to Nn.
【図7】本実施例のメモリ管理装置の全体構成を示す図
である。FIG. 7 is a diagram illustrating an overall configuration of a memory management device according to the present embodiment.
【図8】本実施例のオブジェクトのマーク移動処理の連
続実行手段の構成を示す図である。FIG. 8 is a diagram illustrating a configuration of a continuous execution unit of a mark moving process of an object according to the present embodiment.
【図9】カーとトレインの包含関係を示す図である。FIG. 9 is a diagram showing an inclusion relationship between a car and a train.
【図10】リメンバー集合の要素と参照の関係を示す図
である。FIG. 10 is a diagram showing a relationship between elements of a member set and references.
【図11】プログレス性が保証されない状況(1)を説
明する図である。FIG. 11 is a diagram illustrating a situation (1) in which progress is not guaranteed.
【図12】プログレス性が保証されない状況(2)を説
明する図である。FIG. 12 is a diagram illustrating a situation (2) in which progress is not guaranteed.
【図13】リメンバー集合に多数のポインタ変数が登録
されている状況を説明する図である。FIG. 13 is a diagram illustrating a situation in which many pointer variables are registered in a member set.
【図14】回収に必要なGC回数が多数必要となる状況
を説明する図である。FIG. 14 is a diagram illustrating a situation where a large number of GCs are required for collection.
【図15】オブジェクトがカーに収まり切らない状況を
説明する図である。FIG. 15 is a diagram illustrating a situation where an object does not fit in a car.
11 処理疑似ルート選択手段 12 オブジェクトのマーク移動処理の割り当て手段 13 オブジェクトのマーク移動処理の連続実行手段 14 カー、トレインの削除手段 21 マージャ 22 ハンドルの読み込み手段 23 所属大域カー番号と参照元大域カー番号の更新
手段 24 オブジェクトの移動・マーク処理手段 25 オブジェクト内部のポインタ書き出し手段11 Process pseudo route selecting means 12 Object mark moving processing assigning means 13 Object mark moving processing continuous executing means 14 Car and train deleting means 21 Merger 22 Handle reading means 23 Affiliated global car number and reference source global car number Update means 24 object movement / mark processing means 25 pointer writing means inside object
Claims (13)
セスする機能を備えた言語処理系に対してガーベージコ
レクションを行うメモリ管理方法であって、 記憶領域をカー、トレイン管理用領域と、オブジェクト
用記憶領域と、ハンドルを記憶するための領域に分割
し、オブジェクト本体を上記オブジェクト用記憶領域に
格納し、 上記ハンドルを記憶するための領域にオブジェクトを参
照するハンドルを記憶し、該ハンドルにそのハンドルを
参照しているオブジェクトが所属するカーの内の最大の
大域カー番号を記録し、 ガーベージコレクション処理に際して、最小トレインに
所属するハンドルの参照元から、ガーベージとして回収
しないオブジェクトを参照するハンドル集合を求め、該
ハンドル集合に属するハンドルを、参照元最大カー番号
以上を満たすカーに移動し、 最小トレインからガーベージコレクション対象となるカ
ー、トレインを回収することを特徴とするメモリ管理方
法。1. A memory management method for performing garbage collection for a language processing system having a function of accessing an object by using indirect reference, wherein a storage area is a car, a train management area, and an object storage area. An object is divided into an area for storing a handle, an object body is stored in the storage area for the object, a handle for referring to the object is stored in the area for storing the handle, and the handle is stored in the handle. Record the largest global car number of the car to which the referencing object belongs, and in the garbage collection process, obtain a handle set that refers to the object that is not collected as garbage from the reference source of the handle belonging to the smallest train, The handle belonging to the handle set is referred to as the reference source maximum car number. A memory management method, comprising: moving to a car that satisfies at least the number of vehicles, and collecting a car and a train to be garbage collected from the smallest train.
ージとして回収しないオブジェクトにマーク処理もしく
は移動処理のいずれかの処理を割り当て、 移動処理が割り当てられたオブジェクトを、オブジェク
トの領域長以上の未使用記憶領域に移動させ、マーク処
理が割り当てられてたオブジェクトにマークをつけて、
マークされていないオブジェクトをガーベージとして回
収することを特徴とする請求項1のメモリ管理方法。2. At the time of garbage collection, one of a mark process and a move process is assigned to an object that is not collected as garbage, and the object to which the move process is assigned is moved to an unused storage area equal to or longer than the area length of the object. , Mark objects that have been marked for marking,
2. The memory management method according to claim 1, wherein unmarked objects are collected as garbage.
を越えないような制約の基に、上記マーク処理と移動処
理の割り当てを行うことを特徴とする請求項2のメモリ
管理方法。3. The memory management method according to claim 2, wherein the assignment of the mark processing and the movement processing is performed based on a constraint that a predetermined interruption time of the mutator is not exceeded.
の処理を割り当てるに際し、ルートから参照されている
オブジェクトに対するマーク又は移動処理を割り当てる
処理Aと、最小トレインからn個のカーを選択し該選択
されたカーのオブジェクトに対してマークまたは移動処
理を割り当てる処理Bと、処理Aおよび処理Bを、予め
定められたミューテータの中断時間に応じて選択的に行
うことを特徴とする請求項2または請求項3のメモリ管
理方法。4. When allocating either a mark process or a move process, a process A for allocating a mark or a move process to an object referenced from a route, and selecting n cars from the minimum train and selecting the selected car. 3. A process B for allocating a mark or a movement process to an object of a car that has been set, and the processes A and B are selectively performed according to a predetermined interruption time of the mutator. 3. Memory management method of 3.
セスする機能を備えた言語処理系に対してガーベージコ
レクションを行うメモリ管理装置であって、 記憶領域にカー、トレイン管理用領域と、オブジェクト
本体を格納するためのオブジェクト用記憶領域と、ハン
ドルを格納するためのハンドル記憶領域とを設け、 上記ハンドルを記憶するための領域にオブジェクトを参
照するハンドルを記憶し、該ハンドルにそのハンドルを
参照しているオブジェクトが所属するカーの内の最大の
大域カー番号を記録し、 ガーベージコレクション処理手段は、ガーベージコレク
ション処理に際して、最小トレインに所属するハンドル
の参照元から、ガーベージとして回収しないオブジェク
トを参照するハンドル集合を求め、該ハンドル集合に属
するハンドルを、参照元最大カー番号以上を満たすカー
に移動し、 最小トレインからガーベージコレクション対象となるカ
ー、トレインを回収することを特徴とするメモリ管理装
置。5. A memory management device for performing garbage collection on a language processing system having a function of accessing an object using indirect reference, wherein a storage area includes a car, a train management area, and an object body. An object storage area for storing and a handle storage area for storing a handle are provided. A handle for referring to an object is stored in the area for storing the handle, and the handle is referred to in the handle. The garbage collection processing means records the largest global car number of the car to which the object belongs, and the garbage collection processing means a handle set that refers to an object that is not collected as garbage from a reference source of a handle belonging to the smallest train in the garbage collection processing And the handle belonging to the handle set A memory management device for transferring a dollar to a car satisfying a reference source maximum car number or more, and collecting a car and a train targeted for garbage collection from a minimum train.
ブジェクトのマーク・移動処理の割り当て手段を設け、 上記オブジェクトのマーク・移動処理の割り当て手段
は、ガーベージコレクションに際し、ガーベージコレク
ションの対象とならないオブジェクトにマーク処理もし
くは移動処理のいずれかの処理を割り当て、 ガーベージコレクション処理手段は、移動処理が割り当
てられたオブジェクトを、オブジェクトの領域長以上の
未使用記憶領域に移動させ、マーク処理が割り当てられ
てたオブジェクトにマークをつけて、マークされていな
いオブジェクトをガーベージとして回収することを特徴
とする請求項5のメモリ管理装置。6. The garbage collection processing means includes an object mark / move processing assignment means. The object mark / move processing assignment means assigns a mark processing or an object not to be subjected to garbage collection in the garbage collection. The garbage collection processing means allocates any of the movement processing, moves the object to which the movement processing is allocated to an unused storage area equal to or longer than the area length of the object, and marks the object to which the mark processing is allocated. 6. The memory management device according to claim 5, further comprising: collecting unmarked objects as garbage.
割り当て手段は、予め定められたミューテータの中断時
間を越えないような制約の基に、上記マーク処理と移動
処理の割り当てを行うことを特徴とする請求項6のメモ
リ管理方法。7. The mark / move processing assigning means assigns the mark processing and the movement processing under a constraint not to exceed a predetermined interruption time of the mutator. The memory management method according to claim 6.
割り当て手段は、マーク処理もしくは移動処理のいずれ
かの処理を割り当てるに際し、ルートから参照されてい
るオブジェクトに対するマーク又は移動処理を割り当て
る処理Aと、最小トレインからn個のカーを選択し該選
択されたカーのオブジェクトに対してマークまたは移動
処理を割り当てる処理Bと、処理Aおよび処理Bを、予
め定められたミューテータの中断時間に応じて選択的に
行うことを特徴とする請求項6または請求項7のメモリ
管理装置。8. The method according to claim 1, wherein the assigning means for the mark / move processing of the object includes a processing A for assigning a mark or a move processing to the object referenced from the root when assigning either the mark processing or the move processing. A process B in which n cars are selected from the train and a mark or movement process is assigned to an object of the selected car, and processes A and B are selectively performed according to a predetermined mutator interruption time. 8. The memory management device according to claim 6, wherein the memory management is performed.
セスする機能を備えた言語処理系に対してガーベージコ
レクションを行うメモリ管理プログラムを記憶した記録
媒体であって、 記憶領域をカー、トレイン管理用領域と、オブジェクト
用記憶領域と、ハンドルを記憶するための領域に分割
し、オブジェクト本体を上記オブジェクト用記憶領域に
格納し、 上記ハンドルを記憶するための領域にオブジェクトを参
照するハンドルを記憶し、該ハンドルにそのハンドルを
参照しているオブジェクトが所属するカーの内の最大の
大域カー番号を記録し、 上記メモリ管理プログラムは、ガーベージコレクション
処理に際して、最小トレインに所属するハンドルの参照
元から、ガーベージとして回収しないオブジェクトを参
照するハンドル集合を求め、該ハンドル集合に属するハ
ンドルを、参照元最大カー番号以上を満たすカーに移動
し、 最小トレインからガーベージコレクション対象となるカ
ー、トレインを回収することを特徴とするメモリ管理プ
ログラムを記録した記憶媒体。9. A recording medium storing a memory management program for performing garbage collection for a language processing system having a function of accessing an object using indirect reference, wherein the storage area is a car and a train management area. , An object storage area, and an area for storing a handle, an object body is stored in the object storage area, and a handle for referring to an object is stored in the area for storing the handle. The largest global car number of the car to which the object referring to the handle belongs is recorded in the handle, and the garbage collection process executes the garbage collection process from the handle reference belonging to the smallest train as a garbage. Find a set of handles that refer to objects that will not be reclaimed A storage medium storing a memory management program, wherein a handle belonging to the handle set is moved to a car that satisfies the reference source maximum car number or more, and a garbage collection target car and a train are collected from a minimum train.
ージコレクションに際し、ガーベージコレクションの対
象とならないオブジェクトにマーク処理もしくは移動処
理のいずれかの処理を割り当て、 移動処理が割り当てられたオブジェクトを、オブジェク
トの領域長以上の未使用記憶領域に移動させ、マーク処
理が割り当てられてたオブジェクトにマークをつけて、
マークされていないオブジェクトをガーベージとして回
収することを特徴とする請求項9のメモリ管理プログラ
ムを記録した記憶媒体。10. The memory management program assigns one of a mark process and a move process to an object that is not a target of garbage collection at the time of garbage collection, and sets the object to which the move process is assigned to an object length equal to or longer than the object area length. To an unused storage area, and mark the objects to which mark processing has been assigned,
10. The storage medium according to claim 9, wherein unmarked objects are collected as garbage.
められたミューテータの中断時間を越えないような制約
の基に、上記マーク処理と移動処理の割り当てを行うこ
とを特徴とする請求項10のメモリ管理プログラムを記
録した記憶媒体。メモリ管理方法。11. The memory management program according to claim 10, wherein the memory management program performs the assignment of the mark processing and the movement processing on the basis of a restriction not to exceed a predetermined interruption time of the mutator. A storage medium on which a program is recorded. Memory management method.
処理もしくは移動処理のいずれかの処理を割り当てるに
際し、ルートから参照されているオブジェクトに対する
マーク又は移動処理を割り当てる処理Aと、最小トレイ
ンからn個のカーを選択し該選択されたカーのオブジェ
クトに対してマークまたは移動処理を割り当てる処理B
と、処理Aおよび処理Bを、予め定められたミューテー
タの中断時間に応じて選択的に行うことを特徴とする請
求項10または請求項11のメモリ管理プログラムを記
録した記憶媒体。12. The memory management program, when allocating any one of a mark process and a move process, a process A for allocating a mark or a move process to an object referred to from a root, and n cards from a minimum train. And assigning a mark or a moving process to the object of the selected car
12. The storage medium according to claim 10, wherein the processing A and the processing B are selectively performed according to a predetermined interruption time of the mutator.
クセスする機能を備えた言語処理系に対してガーベージ
コレクションを行うメモリ管理プログラムであって、 記憶領域をカー、トレイン管理用領域と、オブジェクト
用記憶領域と、ハンドルを記憶するための領域に分割
し、オブジェクト本体を上記オブジェクト用記憶領域に
格納し、 上記ハンドルを記憶するための領域にオブジェクトを参
照するハンドルを記憶し、該ハンドルにそのハンドルを
参照しているオブジェクトが所属するカーの内の最大の
大域カー番号を記録し、 上記メモリ管理プログラムは、ガーベージコレクション
処理に際して、最小トレインに所属するハンドルの参照
元から、ガーベージとして回収しないオブジェクトを参
照するハンドル集合を求め、該ハンドル集合に属するハ
ンドルを、参照元最大カー番号以上を満たすカーに移動
し、 最小トレインからガーベージコレクション対象となるカ
ー、トレインを回収することを特徴とするメモリ管理プ
ログラム。13. A memory management program for performing garbage collection for a language processing system having a function of accessing an object using indirect reference, wherein the storage area is a car, a train management area, and an object storage area. An object is divided into an area for storing a handle, an object body is stored in the storage area for the object, a handle for referring to the object is stored in the area for storing the handle, and the handle is stored in the handle. Record the largest global car number of the car to which the referencing object belongs, and the memory management program refers to the object that is not collected as garbage from the reference source of the handle belonging to the minimum train at the time of garbage collection processing A set of handles to be A memory management program characterized by moving a handle belonging to a car belonging to a maximum car number equal to or greater than a reference source maximum car number, and collecting a car and a train to be garbage collected from the smallest train.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2001002477A JP2001265649A (en) | 2000-01-11 | 2001-01-10 | Memory management method and device |
Applications Claiming Priority (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2000002507 | 2000-01-11 | ||
| JP2000-2507 | 2000-01-11 | ||
| JP2001002477A JP2001265649A (en) | 2000-01-11 | 2001-01-10 | Memory management method and device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2001265649A true JP2001265649A (en) | 2001-09-28 |
Family
ID=26583298
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2001002477A Withdrawn JP2001265649A (en) | 2000-01-11 | 2001-01-10 | Memory management method and device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2001265649A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20030094658A (en) * | 2002-06-07 | 2003-12-18 | 이승룡 | Method for explicit dynamic memory management in a system based on automatic dynamic memory management by an application program |
| JP2009501384A (en) * | 2005-07-15 | 2009-01-15 | ビーイーエイ システムズ, インコーポレイテッド | System and method for garbage collection of predictable results in a virtual machine environment |
-
2001
- 2001-01-10 JP JP2001002477A patent/JP2001265649A/en not_active Withdrawn
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20030094658A (en) * | 2002-06-07 | 2003-12-18 | 이승룡 | Method for explicit dynamic memory management in a system based on automatic dynamic memory management by an application program |
| JP2009501384A (en) * | 2005-07-15 | 2009-01-15 | ビーイーエイ システムズ, インコーポレイテッド | System and method for garbage collection of predictable results in a virtual machine environment |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5799185A (en) | Method and system for managing system memory reclamation | |
| JP2004334419A (en) | Magnetic disk device, file management system, and its method | |
| US6874062B1 (en) | System and method for utilizing a hierarchical bitmap structure for locating a set of contiguous ordered search items having a common attribute | |
| WO2012114531A1 (en) | Computer system and data management method | |
| CN100403279C (en) | Data area management method of information recording medium, information processing device using data area management method | |
| JPWO2015093026A1 (en) | Write information storage device, method, and program | |
| CN113704190A (en) | Data writing method and device | |
| JP4825719B2 (en) | Fast file attribute search | |
| JP3609841B2 (en) | File management device | |
| JPH0696025A (en) | System and method for controlling data memory | |
| JP2001265649A (en) | Memory management method and device | |
| US7752405B2 (en) | Data recording apparatus, program product, and data recording method | |
| JPS59220853A (en) | Disc cache system | |
| JP4177833B2 (en) | Method and apparatus for multi-process access to linked list | |
| JPH11338719A (en) | Computer system | |
| CN114442939B (en) | Pre-read data queue processing method and electronic equipment | |
| JPH0764831A (en) | Data storage | |
| JP2787107B2 (en) | Buffer control system and device | |
| CN119668822A (en) | Resource management method, device, equipment and storage medium | |
| JPH0793192A (en) | File management method | |
| CN108415852B (en) | A kind of data access method of flash memory | |
| JPH0991195A (en) | Block memory management device | |
| TW200407704A (en) | Memory data managing method and allocation thereof | |
| JP2004334255A (en) | Area sharing file management device, member deletion method, and program | |
| JPH0652019A (en) | File management device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20080401 |