JPH11338761A - Dynamic memory managing mechanism - Google Patents

Dynamic memory managing mechanism

Info

Publication number
JPH11338761A
JPH11338761A JP14471398A JP14471398A JPH11338761A JP H11338761 A JPH11338761 A JP H11338761A JP 14471398 A JP14471398 A JP 14471398A JP 14471398 A JP14471398 A JP 14471398A JP H11338761 A JPH11338761 A JP H11338761A
Authority
JP
Japan
Prior art keywords
area
garbage collection
object area
pointer
heap
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.)
Pending
Application number
JP14471398A
Other languages
Japanese (ja)
Inventor
Suketada Futamura
祐地 二村
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP14471398A priority Critical patent/JPH11338761A/en
Publication of JPH11338761A publication Critical patent/JPH11338761A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To permit a garbage collecting process which can be placed continuously in operation for a long period and is simple and efficient by specifying a releasing method for an object area when garbage collecting processes by a reference counter system and another system are carried out in combination. SOLUTION: Each reference counter 11 of each object area 10 increases and decreases in the value representing the number of a pointer 12 referring to the object area 10. A garbage collecting means 5 when the garbage collecting processes by the reference counter system and another system are performed in combination releases only a corresponding 1st object area 10 which is released when the value of the reference counter 11 reaches 0. A 2nd object area 10 that the pointer 12 is referring to in the 1st object area does not conduct the updating process of the value of the reference counter 11 and the releasing process of the object area 10 accompanying it.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】この発明は、計算機システム
におけるメモリ管理機構の改良に関し、さらに詳しく述
べればメモリ領域の自動ガベージコレクション手段を有
する動的メモリ管理機構の改良に関するものである。
The present invention relates to an improvement of a memory management mechanism in a computer system, and more particularly to an improvement of a dynamic memory management mechanism having automatic garbage collection means for a memory area.

【0002】[0002]

【従来の技術】例えば、特開昭63−253445号公
報に記載された「データ格納効率の改善方法とシステ
ム」における従来技術の記述に示されるように、動的メ
モリ管理機構におけるメモリの自動ガベージコレクショ
ン処理(以下、「ガベージコレクション処理」、または
「GC処理」と記す)は長年研究がなされてきた分野で
あり、多くの関連分岐を含む技術開発が行われている。
2. Description of the Related Art For example, as shown in the description of the prior art in "Method and System for Improving Data Storage Efficiency" described in JP-A-63-253445, automatic garbage of memory in a dynamic memory management mechanism is disclosed. Collection processing (hereinafter, referred to as “garbage collection processing” or “GC processing”) is a field that has been studied for many years, and technical development including many related branches is being performed.

【0003】ガベージコレクション処理の目的は、計算
機システム内で動作するプログラムがその動作中に動的
メモリ管理機構から獲得し利用する記憶領域について、
プログラムが使わなくなった記憶領域を明示的に開放し
なくても、自動的に回収し再利用できるようにし、記憶
領域の有効活用を図れるようにすることである。
[0003] The purpose of the garbage collection process is to determine a storage area that a program operating in a computer system acquires and uses from a dynamic memory management mechanism during the operation.
It is an object of the present invention to automatically recover and reuse a storage area that is no longer used by a program without explicitly opening the storage area, thereby enabling effective use of the storage area.

【0004】ガベージコレクション処理は、概念的には
2つの段階で構成される。最初の段階では、プログラム
が使用している記憶領域(「生きている」)と、プログ
ラムが使わなくなった記憶領域(「ごみ」)の区別を行
う。そして、次の段階で、「ごみ」を回収し再び利用で
きるようにする。ガベージコレクション処理において動
的メモリ管理機構内の記憶領域が「生きている」か「ご
み」であるかの区別は、記憶領域に対するプログラムか
らの到達可能性によって判断される。まず、動的メモリ
管理機構の外部にあるデータに基づきプログラムが参照
できる記憶領域は「生きている」記憶領域である。次
に、「生きている」記憶領域が保持するデータに基づき
プログラムが参照できる記憶領域も「生きている」記憶
領域と定める。これは再帰的に定義される。「ごみ」の
記憶領域は「生きていない」記憶領域であり、動的メモ
リ管理機構の外部にあるデータと「生きている」記憶領
域が保持するデータのどちらを用いてもプログラムが参
照できない記憶領域と定義される。
The garbage collection process is conceptually composed of two stages. In the first stage, a distinction is made between storage areas used by the program ("live") and storage areas not used by the program ("garbage"). Then, in the next stage, "garbage" is collected and made available again. In the garbage collection process, whether the storage area in the dynamic memory management mechanism is “live” or “garbage” is determined by the reachability of the storage area from the program. First, a storage area that can be referred to by a program based on data outside the dynamic memory management mechanism is a “live” storage area. Next, a storage area that can be referenced by a program based on data held in the “live” storage area is also defined as a “live” storage area. It is defined recursively. The “garbage” storage area is a “non-live” storage area, and cannot be referenced by a program using either data outside the dynamic memory management mechanism or data held by the “live” storage area. Defined as an area.

【0005】図35は、ガベージコレクション処理にお
ける「生きている」記憶領域と「ごみ」の区別を示す解
説図である。動的メモリ管理機構1は、計算機システム
のメモリ領域の一部であるヒープ領域2を含み、同ヒー
プ領域2内にはプログラムが使用する記憶領域であるオ
ブジェクト領域10が1ないし複数存在している。ポイ
ンタ12は、プログラムがオブジェクト領域10を参照
するために用いるデータで、図35ではオブジェクト領
域A、B、X、Yがそれぞれ1ないし2のポインタ12
を含むほか、動的メモリ管理機構1の外部にも2つのポ
インタRp1及びRp2が存在する。
FIG. 35 is an explanatory diagram showing the distinction between "live" storage areas and "garbage" in the garbage collection process. The dynamic memory management mechanism 1 includes a heap area 2 which is a part of a memory area of a computer system, and one or a plurality of object areas 10 which are storage areas used by programs exist in the heap area 2. . The pointer 12 is data used by the program to refer to the object area 10. In FIG. 35, the object areas A, B, X, and Y each have one or two pointers
And two pointers Rp1 and Rp2 exist outside the dynamic memory management mechanism 1.

【0006】図35において、オブジェクト領域A及び
オブジェクト領域Dは、それぞれ動的メモリ管理機構1
の外部にあるポインタRp1およびRp2を用いてプロ
グラムが参照可能であるため、共に「生きている」オブ
ジェクト領域10とみなされる。「生きている」オブジ
ェクト領域A内に含まれるポインタ12から参照可能な
オブジェクト領域B及びCもまた「生きている」オブジ
ェクト領域10である。一方、オブジェクト領域X、Y
並びにZは、動的メモリ管理機構1の外部のポインタR
p1あるいはRp2から、直接にも、他の「生きてい
る」オブジェクト領域10経由でもプログラムから参照
できないため、これらのオブジェクト領域は「ごみ」と
みなされる。
In FIG. 35, an object area A and an object area D respectively correspond to the dynamic memory management mechanism 1
Since the program can be referred to using the pointers Rp1 and Rp2 located outside of the object area, both are regarded as the "living" object area 10. The object areas B and C that can be referenced from the pointer 12 included in the “live” object area A are also “live” object areas 10. On the other hand, object areas X and Y
And Z are pointers R outside the dynamic memory management mechanism 1.
These object areas are regarded as “garbage” because they cannot be referenced from p1 or Rp2 from the program directly or via another “living” object area 10.

【0007】ガベージコレクション処理として提案され
ている各種の方式間の違いは、上記の概念的な2つの段
階を具体的にはどのように実行するかの違いである。ガ
ベージコレクション処理に関する主要な従来技術として
は、基本方式として、「参照カウンタ方式」、「マーク
−スイープ方式」、並びに「ストップ−コピー方式」の
3方式があり、またその重要な改良として「インクリメ
ンタル(歩進)方式」と「ジェネレーショナル(世代)
方式」の2つの方向が挙がる。以下、従来技術とその問
題点を示す。
The difference between the various methods proposed as the garbage collection process is a difference in how to execute the above two conceptual steps. As the main conventional technologies relating to the garbage collection process, there are three basic systems, a "reference counter system", a "mark-sweep system", and a "stop-copy system". Step) and “generational”
There are two directions. Hereinafter, the related art and its problems will be described.

【0008】図36は、第1の従来例である、単純な
「参照カウンタ方式」でガベージコレクション処理を行
う動的メモリ管理機構の構成図である。動的メモリ管理
機構1は、計算機システムのメモリ領域の一部であるヒ
ープ領域2と、同ヒープ領域2からその一部をオブジェ
クト領域10として獲得するメモリ獲得手段3と、獲得
した同オブジェクト領域10を同ヒープ領域2に戻し再
利用可能とするメモリ開放手段4と、同メモリ獲得手段
3により獲得されたがプログラムから利用されなくなっ
たオブジェクト領域10を探索し、同メモリ開放手段4
を用いて同ヒープ領域2に開放するガベージコレクショ
ン手段5から構成される。同ヒープ領域2は、そのアド
レスが連続する単一のメモリ領域であることが多いが、
計算機システムによっては複数のメモリ領域から構成さ
れている場合もある。
FIG. 36 is a configuration diagram of a first conventional example, a dynamic memory management mechanism for performing garbage collection processing by a simple "reference counter method". The dynamic memory management mechanism 1 includes a heap area 2 that is a part of a memory area of the computer system, a memory acquisition unit 3 that acquires a part of the heap area 2 as an object area 10, Memory retrieving means 4 for returning the same to the heap area 2 and reusing it, and searching for the object area 10 acquired by the memory acquiring means 3 but no longer used by the program.
And a garbage collection unit 5 that opens the heap area 2 using The heap area 2 is often a single memory area whose addresses are continuous,
Some computer systems may be composed of a plurality of memory areas.

【0009】同ヒープ領域2には、1ないし複数のオブ
ジェクト領域10が存在し得る。個々のオブジェクト領
域は、メモリ獲得手段3によって生成され、メモリ開放
手段4によって消去される、ヒープ領域2内の小さなメ
モリ領域である。オブジェクト領域10の中にはプログ
ラムの動作に必要な各種の情報が適宜保持される。オブ
ジェクト領域10が保持する情報はプログラムの開発言
語やプログラム設計に大きく依存し、プログラムの動作
に必要なデータだけを含む場合もあれば、プログラムの
命令コードも含む場合もある。
In the heap area 2, one or more object areas 10 can exist. Each object area is a small memory area in the heap area 2 that is generated by the memory acquisition unit 3 and deleted by the memory release unit 4. Various kinds of information necessary for the operation of the program are appropriately held in the object area 10. The information held in the object area 10 largely depends on the development language and program design of the program, and may include only data necessary for the operation of the program, or may include instruction codes of the program.

【0010】各オブジェクト領域10は、それぞれ参照
カウンタ11を持つ。これは参照カウンタ方式のガベー
ジコレクション処理における特徴的な構造である。参照
カウンタ11は、整数値を保持する変数であり、その値
は、対応するオブジェクト領域10がいくつのポインタ
12から参照されているかを示す。
Each object area 10 has a reference counter 11. This is a characteristic structure in the reference counter type garbage collection process. The reference counter 11 is a variable that holds an integer value, and the value indicates how many pointers 12 refer to the corresponding object area 10.

【0011】ポインタ12は、ガベージコレクション処
理を行うときに考慮が必要なプログラムのデータであ
る。ポインタ12は、プログラムがオブジェクト領域1
0を参照するため必要な情報を保持する記憶領域であ
り、計算機のCPUレジスタや、プログラムが静的に配
置したメモリ領域やスタック内の変数(小さなメモリ領
域)、オブジェクト領域10内の変数として存在する。
The pointer 12 is program data that needs to be considered when performing garbage collection processing. The pointer 12 indicates that the program is in the object area 1
This is a storage area for holding information necessary to reference 0, and exists as a CPU register of a computer, a memory area or a stack in a memory (small memory area) where a program is statically arranged, and a variable in the object area 10. I do.

【0012】次に、本従来例の動作について説明する。
図37は、本従来例におけるオブジェクト領域獲得の動
作を示すフローチャートである。オブジェクト領域10
の獲得の動作では、まずヒープ領域2内の未使用部分か
らプログラムにより明示的あるいは暗示的に指定された
適切な大きさのメモリ領域を獲得し(P1101)、次
に獲得した領域をオブジェクト領域10とみなしてその
参照カウンタ11の値を0に設定し(P1102)、さ
らに必要に応じて獲得したオブジェクト領域内のその他
の場所(データ)の初期化を行い(P1103)、その
後オブジェクト領域10を参照するために必要なポイン
タの値を返す(P1104)。ここで、手順P1102
で参照カウンタ11の値を0とするのは、新たに生成し
たオブジェクト領域10が、まだどこのポインタ12か
らも参照されておらず、同オブジェクト領域を参照する
ポインタ12の数が0であることによる。
Next, the operation of the conventional example will be described.
FIG. 37 is a flowchart showing an operation of acquiring an object area in the conventional example. Object area 10
In the operation of acquiring the memory area, first, a memory area of an appropriate size explicitly or implicitly designated by the program is acquired from an unused portion in the heap area 2 (P1101), and the acquired area is then stored in the object area 10 , The value of the reference counter 11 is set to 0 (P1102), and other places (data) in the acquired object area are initialized as necessary (P1103). The value of the pointer required to perform the operation is returned (P1104). Here, the procedure P1102
The value of the reference counter 11 is set to 0 because the newly created object area 10 has not been referenced by any pointer 12 yet, and the number of pointers 12 referring to the object area is 0. by.

【0013】参照カウンタ11の値の更新は、ポインタ
12の値の変更と同期して行われる。図38は、本従来
例におけるポインタ12の値の変更の動作を示すフロー
チャートである。ポインタ12の値の変更の動作P12
0では、まずその値を変更するポインタ12が保持する
値の有効性を検査する(P1201)。もしポインタ1
2が値の変更に先立ちオブジェクト領域10を参照して
いれば(P1201のYes)、本変更により参照先の
オブジェクト領域10を参照するポインタの数が減るの
で、同オブジェクト領域10の参照カウンタ11の値を
1減算する(P1202)。その結果参照カウンタ11
の値が0であれば(P1203のYes)、対象とする
オブジェクト領域10はどこのポインタ12からも参照
されていないオブジェクト領域10、すなわち「ごみ」
となったので、そのオブジェクト領域10の開放を行
う。
The update of the value of the reference counter 11 is performed in synchronization with the change of the value of the pointer 12. FIG. 38 is a flowchart showing an operation of changing the value of the pointer 12 in the conventional example. Operation P12 of changing the value of the pointer 12
If the value is 0, the validity of the value held by the pointer 12 that changes the value is checked (P1201). If pointer 1
If 2 refers to the object area 10 prior to the change of the value (Yes in P1201), this change reduces the number of pointers that refer to the object area 10 of the reference destination. The value is subtracted by 1 (P1202). As a result, the reference counter 11
Is 0 (Yes in P1203), the target object area 10 is an object area 10 that is not referenced by any pointer 12, ie, “garbage”.
, The object area 10 is released.

【0014】オブジェクト領域10の開放では、対象オ
ブジェクト領域10が開放されることで他の1ないし複
数のオブジェクト領域10を参照するポインタも失わ
れ、その結果他のオブジェクト領域10の参照カウンタ
12の値についても調整を行わなければならない場合が
ある。このため、もし対象とするオブジェクト領域10
がその内部に1ないし複数のポインタ12を持っていれ
ば(P1204のYes)、オブジェクト領域10内に
存在するすべてのポインタ12についてそのそれぞれの
値を、ポインタ12の値の変更の動作P120を再帰的
に用いることで、無効な値(オブジェクト領域を参照し
ない値、通常0ないしNULL)に設定し(P120
6、P1207、P1208)、その後メモリ開放手段
4を用い同オブジェクト領域10を開放する(P120
9)。
When the object area 10 is released, the pointer for referring to one or more other object areas 10 is also lost by releasing the target object area 10, and as a result, the value of the reference counter 12 of the other object area 10 is lost. May need to be adjusted. Therefore, if the target object area 10
Has one or more pointers 12 therein (Yes in P1204), recursively returns the values of all the pointers 12 present in the object area 10 and the operation P120 of changing the values of the pointers 12. (P120), an invalid value (a value that does not refer to the object area, usually 0 to NULL) is set.
6, P1207, P1208), and thereafter, the object area 10 is released using the memory release means 4 (P120).
9).

【0015】その後は、まずポインタ12の値を新しい
値に設定し(P1210)、もしその値が有効でオブジ
ェクト領域を参照していれば(P1211のYes)、
参照先のオブジェクト領域を参照するポインタの数が増
えるので、同オブジェクト領域10の参照カウンタ11
の値を1加算し(P1212)、処理を終える。
Thereafter, first, the value of the pointer 12 is set to a new value (P1210). If the value is valid and refers to the object area (Yes in P1211),
Since the number of pointers that refer to the object area of the reference destination increases, the reference counter 11 of the object area 10
Is added by 1 (P1212), and the process ends.

【0016】なお、値を変更する前のポインタ12が参
照するオブジェクト領域10の参照カウンタ11を1減
算しても、参照カウンタ11の値は0にならなければ
(P1203のNo)、対象とするオブジェクト領域1
0は、まだ他のポインタ12から参照されており、使用
中のオブジェクト領域10であるので、オブジェクト領
域の開放処理は行わず、速やかにポインタ12に新しい
値を設定する(P1210)。これは、値を変更する前
のポインタ12の値が無効な値であった場合(P120
1のNo)も同様で、速やかにポインタ12に新しい値
を設定する(P1210)。また、ポインタに設定する
新しい値が無効な値であれば(P1211のNo)、更
新すべき参照カウンタ11が存在しないので手順P12
12は行わず、速やかに処理を終える。
If the value of the reference counter 11 does not become 0 even when the value of the reference counter 11 of the object area 10 referred to by the pointer 12 before the value is changed becomes 1 (No in P1203), the target is set as the target. Object area 1
Since 0 is still being referred to by another pointer 12 and is the object area 10 in use, the object area is not released, and a new value is immediately set in the pointer 12 (P1210). This occurs when the value of the pointer 12 before the value is changed is an invalid value (P120
The same applies to No. 1), which promptly sets a new value to the pointer 12 (P1210). If the new value set in the pointer is an invalid value (No in P1211), there is no reference counter 11 to be updated.
The process is immediately terminated without performing step 12.

【0017】本従来例の具体的な動作の様子を図39、
図40、図41、及び図42を用いて説明する。
FIG. 39 shows a specific operation of the conventional example.
This will be described with reference to FIGS. 40, 41, and 42.

【0018】図39は、本従来例の第1の動作の実施前
を示す解説図である。図39において、ポインタRpは
計算機のCPUレジスタ、プログラムが静的に配置した
メモリ領域、あるいはスタック内の変数として、ヒープ
領域2の外部に存在するポインタ12であり、第1のオ
ブジェクト領域Aを参照している。オブジェクト領域A
はその内部にポインタAp1およびポインタAp2を保
持し、ポインタAp1は第2のオブジェクト領域Bを、
またポインタAp2は第3のオブジェクト領域Cを参照
している。オブジェクト領域Bはその内部にポインタB
p1およびポインタBp2を保持し、ポインタBp1は
ポインタAp2同様オブジェクト領域Cを参照している
が、ポインタBp2はいずれのオブジェクト領域も参照
せず無効な値を保持している。オブジェクト領域Cはそ
の内部にポインタ12を保持しない。オブジェクト領域
AはポインタRpからのみ参照されているので、オブジ
ェクト領域Aの参照カウンタAc1の値は1である。同
様に、オブジェクト領域BはポインタAp1からのみ参
照されているので、その参照カウンタBc1の値は1で
あり、オブジェクト領域CはポインタAp2とポインタ
Bp1から参照されているので、その参照カウンタCc
1の値は2である。
FIG. 39 is an explanatory view showing a state before the first operation of the conventional example. In FIG. 39, a pointer Rp is a pointer 12 existing outside the heap area 2 as a CPU register of a computer, a memory area statically allocated by a program, or a variable in a stack, and refers to the first object area A. doing. Object area A
Holds a pointer Ap1 and a pointer Ap2 therein, and the pointer Ap1 stores the second object area B,
Further, the pointer Ap2 refers to the third object area C. Object area B has pointer B inside
It holds p1 and a pointer Bp2, and the pointer Bp1 refers to the object area C like the pointer Ap2, but the pointer Bp2 does not refer to any object area and holds an invalid value. The object area C does not hold the pointer 12 therein. Since the object area A is referred to only by the pointer Rp, the value of the reference counter Ac1 of the object area A is 1. Similarly, since the object area B is referred to only by the pointer Ap1, the value of the reference counter Bc1 is 1, and since the object area C is referred to by the pointer Ap2 and the pointer Bp1, its reference counter Cc
The value of 1 is 2.

【0019】図39に示される状況において、ポインタ
Rpを無効な値に変更する動作P120は次の通りとな
る。変更前のポインタRpの値はオブジェクト領域Aを
参照する有効な値なので、P1201、P1202と進
む。P1202の結果、参照カウンタAc1の値は0と
なるので、P1203のYesへ進み、さらにオブジェ
クト領域Aは内部にポインタAp1およびAp2を含む
ので、P1204のYesからP1205へと処理を進
め、まずポインタAp1についてP1206を実行す
る。P1206ではポインタAp1に対しP120を再
帰的に実行、これによりポインタAp1の参照するオブ
ジェクト領域Bの参照カウンタBc1の値が1から0に
減少し(ポインタAp1に対するP120内のP120
2)、オブジェクト領域Bの保持するポインタBp1の
参照先であるオブジェクト領域Cの参照カウンタCc1
の値も1減じられたのち(ポインタBp1に対するP1
20内のP1202)、オブジェクト領域Bは開放され
(ポインタAp1に対するP120内のP1209)、
ポインタAp1の値は無効な値に設定される(ポインタ
Ap1に対するP120内のP1210)。図40は、
本段階の状況を示す解説図であり、図39に対し、参照
カウンタAc1、参照カウンタBc1、参照カウンタC
c1がすべて1減じられ、オブジェクト領域Bが開放さ
れ(破線)、ポインタAp1およびポインタBp1に無
効な値に設定されている。
In the situation shown in FIG. 39, the operation P120 of changing the pointer Rp to an invalid value is as follows. Since the value of the pointer Rp before the change is a valid value referring to the object area A, the process proceeds to P1201 and P1202. As a result of P1202, the value of the reference counter Ac1 becomes 0, so the process proceeds to Yes in P1203. Further, since the object area A includes the pointers Ap1 and Ap2 inside, the process proceeds from Yes in P1204 to P1205, and first the pointer Ap1 Is performed for P1206. In P1206, P120 is recursively executed for the pointer Ap1, whereby the value of the reference counter Bc1 of the object area B referred to by the pointer Ap1 decreases from 1 to 0 (P120 in the P120 for the pointer Ap1).
2) The reference counter Cc1 of the object area C to which the pointer Bp1 held by the object area B is referred
Is also reduced by 1 (P1 for pointer Bp1)
20, the object area B is released (P1209 in P120 for the pointer Ap1),
The value of the pointer Ap1 is set to an invalid value (P1210 in P120 for the pointer Ap1). FIG.
39 is an explanatory diagram showing a situation at this stage. FIG. 39 shows a reference counter Ac1, a reference counter Bc1, and a reference counter C with respect to FIG.
c1 is decremented by one, the object area B is released (broken line), and the pointer Ap1 and the pointer Bp1 are set to invalid values.

【0020】P1206でのポインタAp1に対するP
120の実行が終了すると、処理はP1207のNo、
P1208と進み、続くP1206では今度はポインタ
Ap2に対しP120を再帰的に実行する。これにより
ポインタAp2の参照するオブジェクト領域Cの参照カ
ウンタCc1の値が1から0に減少し(ポインタAp2
に対するP120内のP1202)、オブジェクト領域
Cもまた開放され(ポインタAp2に対するP120内
のP1209)、ポインタAp2の値は無効な値に設定
される(ポインタAp2に対するP120内のP121
0)。図41は、本段階の状況を示す解説図であり、図
40に対し、参照カウンタCc1が1減じられ、オブジ
ェクト領域Cが開放され(破線)、ポインタAp2が無
効な値に設定されている。
P for pointer Ap1 at P1206
When the execution of step 120 is completed, the processing is No in P1207,
The process proceeds to P1208, and in P1206, P120 is recursively executed for the pointer Ap2. As a result, the value of the reference counter Cc1 of the object area C referenced by the pointer Ap2 decreases from 1 to 0 (pointer Ap2
, The object area C is also released (P1209 in P120 for the pointer Ap2), and the value of the pointer Ap2 is set to an invalid value (P121 in P120 for the pointer Ap2).
0). FIG. 41 is an explanatory diagram showing the situation at this stage. In FIG. 40, the reference counter Cc1 is decreased by 1, the object area C is released (broken line), and the pointer Ap2 is set to an invalid value.

【0021】P1206でのポインタAp2に対するP
120の実行が終了し、オブジェクト領域A内のすべて
のポインタを無効に設定し終えると(P1207のYe
s)、オブジェクト領域Aを開放(P1209)したの
ちポインタRpの値を無効な値に設定し(P121
0)、その後P120を終える。図42は、本段階の状
況を示す解説図であり、図41に対しオブジェクト領域
Aが開放され(破線)、ポインタRpが無効な値に設定
され、結果としてオブジェクト領域A、オブジェクト領
域B、オブジェクト領域Cはすべて開放される。
P for pointer Ap2 at P1206
When the execution of H.120 is completed and all pointers in the object area A are set to be invalid (Ye in P1207)
s), after releasing the object area A (P1209), the value of the pointer Rp is set to an invalid value (P121).
0), then end P120. FIG. 42 is an explanatory diagram showing a situation at this stage. In FIG. 41, the object area A is opened (broken line), the pointer Rp is set to an invalid value, and as a result, the object area A, the object area B, and the object All areas C are released.

【0022】本従来例に示した参照カウンタ方式のガベ
ージコレクション処理は上記のように動作することで、
「ごみ」の識別と回収、再利用を実現している。参照カ
ウンタ方式は、上記のようにガベージコレクション処理
が応用プログラムの動作の延長上で少しずつ行われると
いう特徴および長所がある。しかし一方で循環した参照
により「ごみ」を回収し損ねるという問題がある。本問
題の具体的な様子を図43、及び図44を用いて示す。
The garbage collection process of the reference counter method shown in the conventional example operates as described above,
It realizes the identification, collection and reuse of "garbage". The reference counter method has a feature and an advantage that the garbage collection process is performed little by little as an extension of the operation of the application program as described above. However, on the other hand, there is a problem in that "refuse" cannot be collected due to the circulating reference. A specific state of this problem will be described with reference to FIGS. 43 and 44.

【0023】図43は、本従来例の第2の動作の実施前
を示す解説図である。図43において、ポインタRpは
図39同様、ヒープ領域2の外部に存在するポインタ1
2であり、本図では第1のオブジェクト領域Dを参照し
ている。オブジェクト領域Dはその内部にポインタDp
1およびポインタDp2を保持し、ポインタDp1は第
2のオブジェクト領域Eを、またポインタDp2は第3
のオブジェクト領域Fを参照している。オブジェクト領
域Eはその内部にポインタEp1およびポインタEp2
を保持し、ポインタEp1はポインタDp2同様オブジ
ェクト領域Fを参照しているが、ポインタEp2はいず
れのオブジェクト領域も参照せず無効な値を保持してい
る。オブジェクト領域Fはその内部にポインタFp1を
保持し、ポインタFp1はオブジェクト領域Eを参照し
ている。オブジェクト領域DはポインタRpからのみ参
照されているので、オブジェクト領域Dの参照カウンタ
Dc1の値は1である。同様に、オブジェクト領域Eは
ポインタDp1とポインタFp1から参照されているの
で、その参照カウンタEc1の値は2であり、オブジェ
クト領域FはポインタDp2とポインタEp1から参照
されているので、その参照カウンタFc1の値も2であ
る。
FIG. 43 is an explanatory diagram showing a state before the second operation of the conventional example. In FIG. 43, the pointer Rp is the pointer 1 existing outside the heap area 2 as in FIG.
2, which refers to the first object area D in FIG. The object area D has a pointer Dp
1 and the pointer Dp2, the pointer Dp1 stores the second object area E, and the pointer Dp2 stores the third
Of the object area F of FIG. The object area E has pointers Ep1 and Ep2 therein.
The pointer Ep1 refers to the object area F like the pointer Dp2, but the pointer Ep2 does not refer to any object area and holds an invalid value. The object area F holds a pointer Fp1 therein, and the pointer Fp1 refers to the object area E. Since the object area D is referenced only by the pointer Rp, the value of the reference counter Dc1 of the object area D is 1. Similarly, since the object area E is referred to by the pointer Dp1 and the pointer Fp1, the value of the reference counter Ec1 is 2, and the object area F is referred to by the pointer Dp2 and the pointer Ep1. Is also 2.

【0024】図43に示される状況においてポインタR
pを無効な値に変更する動作P120は次の通りとな
る。変更前のポインタRpの値はオブジェクト領域Dを
参照する有効な値なので、P1201、P1202と進
む。P1202の結果、参照カウンタDc1の値は0と
なるので、P1203のYesへ進み、さらにオブジェ
クト領域Dは内部にポインタDp1およびDp2を含む
ので、P1204のYesからP1205へと処理を進
め、まずポインタDp1についてP1206を実行す
る。P1206ではポインタDp1に対しP120を再
帰的に実行、これによりポインタDp1の参照するオブ
ジェクト領域Eの参照カウンタEc1の値が2から1に
減少する(ポインタDp1に対するP120内のP12
02)。しかし、ここでは前述の本従来例の第1の動作
と異なり、オブジェクト領域Eの参照カウンタEc1の
値は0にならないため、オブジェクト領域Eは開放され
ることなく(ポインタDp1に対するP120内のP1
203のNo)、ポインタDp1の値が無効な値に設定
される(ポインタDp1に対するP120内のP121
0)。
In the situation shown in FIG.
The operation P120 of changing p to an invalid value is as follows. Since the value of the pointer Rp before the change is a valid value referring to the object area D, the process proceeds to P1201 and P1202. As a result of P1202, since the value of the reference counter Dc1 becomes 0, the process proceeds to Yes in P1203. Further, since the object area D includes the pointers Dp1 and Dp2 therein, the process proceeds from Yes in P1204 to P1205. Is performed for P1206. In P1206, P120 is recursively executed for the pointer Dp1, whereby the value of the reference counter Ec1 of the object area E referred to by the pointer Dp1 decreases from 2 to 1 (P12 in P120 for the pointer Dp1).
02). However, here, unlike the above-described first operation of the conventional example, the value of the reference counter Ec1 of the object area E does not become 0, and thus the object area E is not released (P1 in P120 with respect to the pointer Dp1).
203, No), the value of the pointer Dp1 is set to an invalid value (P121 in P120 for the pointer Dp1)
0).

【0025】P1206でのポインタDp1に対するP
120の実行が終了すると、処理はP1207のNo、
P1208と進み、続くP1206では今度はポインタ
Dp2に対しP120を再帰的に実行する。これにより
ポインタDp2の参照するオブジェクト領域Fの参照カ
ウンタFc1の値が2から1に減少するが(ポインタD
p2に対するP120内のP1202)、やはり本従来
例の第1の動作と異なり、オブジェクト領域Fの参照カ
ウンタFc1の値は0にならないため、オブジェクト領
域Fも開放されることなく(ポインタDp2に対するP
120内のP1203のNo)、ポインタDp2の値は
無効な値に設定される(ポインタDp2に対するP12
0内のP1210)。
P for pointer Dp1 at P1206
When the execution of step 120 is completed, the processing is No in P1207,
The process proceeds to P1208, and in P1206, P120 is recursively executed for the pointer Dp2. Thereby, the value of the reference counter Fc1 of the object area F referred to by the pointer Dp2 decreases from 2 to 1 (pointer Dp2).
Also, unlike the first operation of the conventional example, the value of the reference counter Fc1 of the object area F does not become 0, so that the object area F is not released (P1202 in P120 with respect to the pointer Dp2).
No in P1203 in 120), the value of the pointer Dp2 is set to an invalid value (P12 for the pointer Dp2).
P1210 in 0).

【0026】P1206でのポインタDp2に対するP
120の実行が終了し、オブジェクト領域D内のすべて
のポインタを無効に設定し終えると(P1207のYe
s)、オブジェクト領域Dを開放(P1209)したの
ち、ポインタRpの値を無効な値に設定し(P121
0)、その後P120を終える。図44は、本段階の状
況を示す、本従来例の第2の動作実施後を示す解説図で
あり、図43に対し参照カウンタEc1及び参照カウン
タFc1が減じられ、オブジェクト領域Dが開放され
(破線)、ポインタRpが無効な値に設定されている
が、結果として、オブジェクト領域Eおよびオブジェク
ト領域Fは、ヒープ領域外のポインタあるいは「生きて
いる」オブジェクト領域を経由してプログラムから参照
することができない「ごみ」となったオブジェクト領域
であるにも関わらず、その領域を開放できない。
P for pointer Dp2 at P1206
When the execution of H.120 is completed and all pointers in the object area D are set to be invalid (Ye in P1207)
s), after releasing the object area D (P1209), the value of the pointer Rp is set to an invalid value (P121
0), then end P120. FIG. 44 is an explanatory view showing a situation at this stage after the second operation of the conventional example is performed. In FIG. 43, the reference counter Ec1 and the reference counter Fc1 are decreased, and the object area D is released ( (Broken line), the pointer Rp is set to an invalid value, but as a result, the object area E and the object area F can be referenced from the program via a pointer outside the heap area or a “live” object area. Despite being a "garbage" object area, the area cannot be released.

【0027】上記の本従来例の第2の動作に示した、参
照カウンタ方式における「ごみ」回収漏れの問題は、動
的メモリ管理機構内で使用可能なヒープ領域2の見かけ
の大きさが次第に小さくなるという、メモリリーク現象
を引き起こす。本現象の発生は計算機システムが長期連
続運転できないことを意味し、長期間にわたる無停止運
転が前提の産業系計算機システムでは許容することがで
きない。よって参照カウンタ方式は「ごみ」の回収漏れ
をさけるため、他の方式との併用が必要であることが指
摘されている。
The problem of "garbage" collection omission in the reference counter method shown in the above-described second operation of the conventional example is that the apparent size of the heap area 2 that can be used in the dynamic memory management mechanism gradually increases. It causes a memory leak phenomenon that it becomes smaller. The occurrence of this phenomenon means that the computer system cannot be operated continuously for a long period of time, and cannot be tolerated in an industrial computer system on the premise of nonstop operation for a long period of time. Therefore, it has been pointed out that the reference counter method needs to be used in combination with another method in order to prevent the "garbage" from being collected.

【0028】また、上記第1の従来例に示した単純な参
照カウンタ式のガベージコレクション処理では、開放す
るオブジェクト領域10が内部に有効なポインタ12を
持つ場合、そのポインタ12の指すオブジェクト領域1
0に対しても再帰的に参照カウンタの値の調整処理を行
うので(P1206)、1つのオブジェクト領域10の
開放が連鎖的に多数のオブジェクト領域10の開放につ
ながる場合があり、ポインタの値の変更の動作P120
に要する時間が不定で予測困難であるという問題があ
る。本問題に対する対策として第2の従来例を説明す
る。
In the simple reference counter type garbage collection process shown in the first conventional example, if the object area 10 to be released has a valid pointer 12 therein, the object area 1 indicated by the pointer 12
Since the adjustment process of the value of the reference counter is performed recursively even for 0 (P1206), opening of one object area 10 may lead to opening of many object areas 10 in a chain. Change operation P120
There is a problem that the required time is indeterminate and difficult to predict. As a countermeasure against this problem, a second conventional example will be described.

【0029】第2の従来例は、上記の第1の従来例にお
けるポインタの値の変更の動作を改善したものであり、
その構成及びオブジェクト領域の獲得の動作は、それぞ
れ第1の従来例の構成(図36)及び第1の従来例にお
けるオブジェクト領域の獲得の動作(図37)と同一で
あるので、説明を省略する。第2の従来例におけるポイ
ンタの値の変更の動作およびガベージコレクション処理
(GC処理)の動作を図45を用いて説明する。
The second conventional example is an improvement of the operation of changing the value of the pointer in the first conventional example.
The configuration and the operation of obtaining the object area are the same as the configuration of the first conventional example (FIG. 36) and the operation of obtaining the object area in the first conventional example (FIG. 37), respectively, and thus the description thereof will be omitted. . The operation of changing the pointer value and the operation of the garbage collection process (GC process) in the second conventional example will be described with reference to FIG.

【0030】図45は、第2の従来例の動作を示すフロ
ーチャートである。第2の従来例におけるポインタ12
の値の変更の動作P130でも、まず第1の従来例の手
順P120と同じく、ポインタ12が保持する値を検査
し(P1201)、もしポインタ12が有効なオブジェ
クト領域10を参照していれば(P1201のYe
s)、参照するオブジェクト領域10の参照カウンタ1
1の値を1減算する(P1202)。しかし、その結果
参照カウンタ11の値が0であったときは(P1203
のYes)、即座にオブジェクト領域10開放の処理を
行うのではなく、一旦参照するオブジェクト領域10を
ごみリスト21に追加する(P1301)にとどめる。
この点が第1の従来例におけるポインタ12の値の変更
の動作P120と異なる特徴である。その後は、また第
1の従来例の手順P120と同じく、ポインタ12の値
を新しい値に設定し(P1210)、もしその値が有効
でオブジェクト領域を参照していれば(P1211のY
es)、同オブジェクト領域10の参照カウンタ11の
値を1加算し(P1212)、処理を終える。なお、値
を変更する前に参照しているオブジェクト領域10の参
照カウンタ11を1減算しても、参照カウンタ11の値
は0にならなければ(P1203のNo)、対象とする
オブジェクト領域10の開放のための処理は行わず速や
かにポインタ12に新しい値を設定する(P121
0)、値を変更する前のポインタ12の値が無効な値で
あった場合(P1201のNo)も速やかにポインタ1
2に新しい値を設定する(P1210)、ポインタに設
定する新しい値が無効な値あれば(P1211のN
o)、更新すべき参照カウンタ11が存在しないので手
順P212は行わず、速やかに処理を終える点も、第1
の従来例と同じである。
FIG. 45 is a flowchart showing the operation of the second conventional example. Pointer 12 in second conventional example
In the operation P130 of changing the value of (1), first, similarly to the procedure P120 of the first conventional example, the value held by the pointer 12 is checked (P1201), and if the pointer 12 refers to the valid object area 10 ( Ye of P1201
s), reference counter 1 of object area 10 to be referred to
The value of 1 is subtracted by 1 (P1202). However, as a result, when the value of the reference counter 11 is 0 (P1203
Yes), the object area 10 to be referred to is temporarily added to the garbage list 21 (P1301) instead of immediately performing the processing of releasing the object area 10.
This is a feature different from the operation P120 of changing the value of the pointer 12 in the first conventional example. Thereafter, as in the procedure P120 of the first conventional example, the value of the pointer 12 is set to a new value (P1210). If the value is valid and refers to the object area (Y in P1211)
es), the value of the reference counter 11 of the object area 10 is incremented by 1 (P1212), and the process ends. If the value of the reference counter 11 does not become 0 even if the reference counter 11 of the object area 10 referred to before the value is changed becomes 1 (No in P1203), the value of the target object area 10 is not changed. A new value is immediately set in the pointer 12 without performing the processing for releasing (P121
0), when the value of the pointer 12 before the value is changed is an invalid value (No in P1201), the pointer 1 is promptly changed.
2 is set to a new value (P1210). If the new value to be set to the pointer is an invalid value (N in P1211)
o) Since the reference counter 11 to be updated does not exist, the procedure P212 is not performed, and the process ends promptly.
Is the same as the conventional example.

【0031】手順P1301で、ごみリスト21につな
がれたオブジェクト領域10は、別途応用プログラムの
動作とは平行して適宜動作するガベージコレクション処
理(GC処理)P131によって開放される。
In step P1301, the object area 10 connected to the garbage list 21 is released by a garbage collection process (GC process) P131 that operates appropriately in parallel with the operation of the application program.

【0032】手順P131では、まず、ごみリスト21
に含まれ開放の対象となっているオブジェクト領域10
の有無を調べ(P1311)、もしあれば(P1311
のYes)、ごみリストから開放すべき未処理のオブジ
ェクト領域10を1つ選択する(P1312)。なおこ
のとき、もしごみリスト21が空で開放すべきオブジェ
クト領域10は存在しなければ(P1311のNo)、
速やかに処理を終える。ついで手順P1312で選択し
たオブジェクト領域10について、そのオブジェクト領
域10が内部にポインタ12を保持していれば(P13
13のYes)、そのなかからまず1つの未処理のポイ
ンタ12を選択し(P1314)、その値が有効である
かを調べ(P1201)、有効であれば(P1201の
Yes)そのポインタ12が参照するオブジェクト領域
10の参照カウンタ11の値を1減算し(P120
2)、その結果参照カウンタの値が0になれば(P12
03のYes)、そのポインタ12が参照するオブジェ
クト領域10を開放すべく新たにごみリスト21に加え
る(P1301)。ついでさらに未処理のポインタ12
があれば(P1315のNo)、未処理のポインタ12
について手順P1201、P1202、P1203、P
1301を繰り返したうえで、ごみリストから獲得し開
放の対象となっているオブジェクト領域10自体をメモ
リ開放手段4を用いて開放する。その後は、まだごみリ
ストに開放すべき他のオブジェクト領域10が存在すれ
ば(P1316のNo)、未処理のオブジェクト領域1
0についてさらに手順P1312、P1313....
と上記の処理を繰り返す。
In the procedure P131, first, the garbage list 21
Object area 10 that is included in and is to be released
(P1311), and if any (P1311)
Yes), one unprocessed object area 10 to be released is selected from the garbage list (P1312). At this time, if there is no object area 10 to be released because the garbage list 21 is empty (No in P1311),
Finish the process promptly. Next, regarding the object area 10 selected in the procedure P1312, if the object area 10 holds the pointer 12 therein (P13
13), one unprocessed pointer 12 is selected from among them (P1314), and it is checked whether the value is valid (P1201). If it is valid (Yes in P1201), the pointer 12 is referred to The value of the reference counter 11 of the object area 10 to be subtracted by 1 (P120
2) As a result, if the value of the reference counter becomes 0 (P12
03, Yes), the object area 10 referred to by the pointer 12 is newly added to the garbage list 21 so as to be released (P1301). Then further unprocessed pointer 12
If there is (No in P1315), the unprocessed pointer 12
Procedure P1201, P1202, P1203, P
After repeating 1301, the object area 10 itself obtained from the garbage list and to be released is released using the memory release means 4. Thereafter, if there is still another object area 10 to be released in the garbage list (No in P1316), the unprocessed object area 1
0 for the procedures P1312, P1313. . . .
And the above processing is repeated.

【0033】第2の従来例では上記のように動作するこ
とで、第1の従来例とは異なり、応用プログラムの処理
の一部として実行されるポインタの値の変更の動作P1
30に要する時間が予測可能となるという特徴および長
所がある。しかし、第1の従来例に比べ、応用プログラ
ムの処理とは独立してガベージコレクション処理P13
1を稼動させなければならず、その処理は複雑となる。
また、手順P131は、高い頻度で動作させればシステ
ムの負荷になり、低い頻度で動作させれば応用プログラ
ムの動作に「ごみ」オブジェクト領域の回収、再利用が
間に合わなくなるため、どのように動作させるか定める
ことが難しい。さらに、第1の従来例同様、循環した参
照により「ごみ」の回収漏れが発生する欠点は残ってお
り、やはり他の方式との併用が必要で、併用する他の方
式と手順P131の動作の相互干渉の回避も必要とな
り、これらを考慮すると処理はさらに複雑になるという
問題点がある。
The second conventional example operates as described above, so that unlike the first conventional example, the operation P1 of changing the value of the pointer executed as part of the processing of the application program is performed.
There is a feature and an advantage that the time required for 30 is predictable. However, compared to the first conventional example, the garbage collection process P13 is performed independently of the process of the application program.
1 must be operated, and the processing becomes complicated.
In addition, if the procedure P131 is operated at a high frequency, the load on the system is reduced. If the procedure P131 is performed at a low frequency, the collection and reuse of the “garbage” object area cannot be performed in time for the operation of the application program. It is difficult to decide what to do. Further, as in the first conventional example, there still remains a drawback that "garbage" is leaked due to circulating reference, and it is necessary to use the method in combination with another method. It is necessary to avoid mutual interference, and there is a problem that the processing is further complicated when these are taken into consideration.

【0034】次に、第3の従来例を用いて、マーク−ス
イープ方式と呼ばれるガベージコレクション処理につい
て説明する。マーク−スイープ方式は、第1および第2
の従来例で示した参照カウンタ方式における循環した参
照による「ごみ」の回収漏れ問題を改善している方式で
ある。
Next, a garbage collection process called a mark-sweep method will be described using a third conventional example. The mark-sweep method includes the first and second
This is a method for improving the problem of "garbage" being missed due to circulating reference in the reference counter method shown in the conventional example.

【0035】図46は、第3の従来例である、マーク−
スイープ方式でガベージコレクション処理を行う動的メ
モリ管理機構の構成図である。図46において、動的メ
モリ管理機構1、ヒープ領域2、ガベージコレクション
手段5、オブジェクト領域10、ポインタ12は、図3
6と同じであるので説明を省略する。ヒープ領域2は、
さらに、未だ利用されていないメモリ領域から構成され
る残利用可能領域13と、既にプログラムから利用され
ているメモリ領域から構成される既獲得済み領域14の
2つの領域から構成される。オブジェクト領域10は、
まずメモリ獲得手段3によりヒープ領域2の一部である
残利用可能領域13から獲得され、これにより獲得され
たオブジェクト領域10は既獲得済み領域14の一部を
構成するようになる。また、オブジェクト領域10はメ
モリ開放手段4によって開放されると、再び残利用可能
領域13の一部を構成するようになり、その領域は再利
用可能となる。残利用可能領域13内の利用可能なメモ
リ領域はフリーリスト18により管理され、オブジェク
ト領域10は、メモリ獲得手段3によりフリーリスト1
8内の適切な領域が割当てられることで獲得され、メモ
リ開放手段4によりフリーリスト18に戻されるよう動
作する。
FIG. 46 shows a third conventional example, in which a mark-
FIG. 3 is a configuration diagram of a dynamic memory management mechanism that performs a garbage collection process by a sweep method. In FIG. 46, the dynamic memory management mechanism 1, the heap area 2, the garbage collection means 5, the object area 10, and the pointer 12
6, the description is omitted. Heap area 2 is
Further, it is composed of two areas, a remaining available area 13 composed of a memory area not yet used and an already acquired area 14 composed of a memory area already used by the program. The object area 10
First, the memory area is acquired from the remaining available area 13 which is a part of the heap area 2 by the memory acquiring means 3, and the acquired object area 10 constitutes a part of the already acquired area 14. Further, when the object area 10 is released by the memory releasing means 4, the object area 10 again constitutes a part of the remaining available area 13, and the area can be reused. The available memory area in the remaining available area 13 is managed by the free list 18, and the object area 10 is stored in the free list 1 by the memory acquisition unit 3.
8 is obtained by allocating an appropriate area in the area 8 and returned to the free list 18 by the memory release means 4.

【0036】既獲得済み領域14には、1ないし複数の
オブジェクト領域10が存在し得る。第1の従来例と異
なり、参照カウンタ11は持たないが、代わりにマーク
20の領域を持つ。これはマーク−スイープ方式または
その類型のガベージコレクション処理における特徴的な
構造である。このマークは、主に対応するオブジェクト
領域が使用中とみなせるか否かの状態を保持する変数で
あり、ガベージコレクション処理の中で操作される。
One or more object areas 10 can exist in the already acquired area 14. Unlike the first conventional example, it does not have the reference counter 11 but has a mark 20 area instead. This is a characteristic structure in the garbage collection processing of the mark-sweep method or a type thereof. This mark is a variable mainly holding a state of whether or not the corresponding object area can be regarded as being used, and is operated during the garbage collection process.

【0037】次に、本従来例の動作について説明する。
図47は、本従来例におけるガベージコレクション処理
(GC処理)の動作を示すフローチャートである。本従
来例におけるガベージコレクション処理は、大きく4つ
の段階を踏む。まず最初に、既獲得済み領域14内に存
在するすべてのオブジェクト領域10のマーク20を
「未使用」と印付ける(P1401)。次に計算機のC
PUレジスタ、プログラムが静的に配置したメモリ領
域、あるいはスタック内の変数としてヒープ領域2の外
部に存在するすべてのポインタ12について、それらの
ポインタ12から直接参照されるオブジェクト領域10
を探索し、そのマーク20を「使用中」と印付けする
(P141)。その後、既獲得済み領域14にあってマ
ーク20が「使用中」となっているオブジェクト領域1
0を探索し、該当するオブジェクト領域10から参照さ
れるオブジェクト領域10についてもマーク20を「使
用中」とする(P142)。手順P141、P142に
よりヒープ領域外のポインタ12から直接または間接に
参照できるすべてのオブジェクト領域10のマーク20
を「使用中」としたので、本段階でマークが「未使用」
となっている既獲得済み領域14内のオブジェクト領域
10は「ごみ」とみなすことができ、最後に既獲得済み
領域14内でマーク20が「未使用」のオブジェクト領
域10すべてをメモリ開放手段4を用いて開放する(P
143)。
Next, the operation of the conventional example will be described.
FIG. 47 is a flowchart showing the operation of the garbage collection process (GC process) in the conventional example. The garbage collection process in this conventional example roughly includes four stages. First, the marks 20 of all the object areas 10 existing in the already acquired area 14 are marked as “unused” (P1401). Next, C
For the PU register, a memory area statically allocated by the program, or all the pointers 12 existing outside the heap area 2 as variables in the stack, an object area 10 directly referred to by the pointers 12
And marks the mark 20 as “in use” (P141). Then, the object area 1 in the already acquired area 14 and the mark 20 is “in use”
0 is searched, and the mark 20 is set to “in use” for the object area 10 referenced from the corresponding object area 10 (P142). Marks 20 of all object areas 10 that can be referenced directly or indirectly from pointer 12 outside the heap area by procedures P141 and P142
Is marked as “in use”, so the mark is “unused” at this stage.
Can be regarded as “garbage”. Finally, all the object areas 10 with the mark “unused” in the already acquired area 14 are marked as “garbage”. Open using (P
143).

【0038】次に、手順P141、P142、P143
の詳細を示す。手順P141では、まずヒープ領域2外
にある適切なポインタ12の1つを選択し(P141
1)、そのポインタ12が有効であれば(P1201の
Yes)、ポインタ12が参照するオブジェクト領域1
0のマーク20を「使用中」とし(P1412)、本手
順をヒープ領域2の外にあるすべてのポインタ12につ
いて繰り返す(P1413のYes、P1414)。
Next, procedures P141, P142, P143
The details are shown below. In the procedure P141, first, one of the appropriate pointers 12 outside the heap area 2 is selected (P141
1) If the pointer 12 is valid (Yes in P1201), the object area 1 referenced by the pointer 12
The mark 20 of 0 is set to “in use” (P1412), and this procedure is repeated for all pointers 12 outside the heap area 2 (Yes in P1413, P1414).

【0039】手順P142では、既獲得済み領域14内
にマーク20が「使用中」であるオブジェクト領域10
があれば(P1421のYes)、まず該当するオブジ
ェクト領域10を1つ選択し(P1422)、選択した
オブジェクト領域10が内部にポインタ12を含めば
(P1313のYes)、まず選択したオブジェクト領
域10に含まれるポインタ12の1つを選び(P131
4)、その値が有効で参照先オブジェクト領域10のマ
ーク20が「未使用」であれば(P1201のYe
s)、参照先のオブジェクト領域10のマーク20を
「使用中」に設定し探索対象に加え(P1424)、本
手順を選択したオブジェクト領域10の内部に含まれる
すべてのポインタ12に繰り返し行い(P1315のN
o)、さらに既獲得済み領域14内でマーク20が「使
用中」のオブジェクト領域10のすべてについて上記手
順を繰り返す(P1425)。
In the procedure P142, the object area 10 in which the mark 20 is "in use" is set in the already acquired area 14.
If there is (Yes in P1421), first, one corresponding object area 10 is selected (P1422). If the selected object area 10 includes the pointer 12 therein (Yes in P1313), the selected object area 10 is first selected. Select one of the included pointers 12 (P131
4) If the value is valid and the mark 20 of the reference object area 10 is “unused” (Ye of P1201)
s), the mark 20 of the reference object area 10 is set to “in use” and added to the search target (P1424), and this procedure is repeated for all the pointers 12 included in the selected object area 10 (P1315). N
o) Further, the above procedure is repeated for all the object areas 10 in which the mark 20 is “in use” in the already acquired area 14 (P1425).

【0040】手順143では、既獲得済み領域14内に
あるマーク20が「未使用」のオブジェクト領域10を
選択し(P1431)、選択したオブジェクト領域10
をメモリ開放手段4を用いて開放、フリーリスト18に
つなげ(P1209)、本手順を既獲得済み領域14内
にあるマーク20が「未使用」のオブジェクト領域10
に対し繰り返す(P1432のNo)。
In step 143, the object area 10 in which the mark 20 in the already acquired area 14 is "unused" is selected (P1431), and the selected object area 10 is selected.
Is released using the memory release means 4 and connected to the free list 18 (P1209), and this procedure is performed.
(No in P1432).

【0041】本従来例の具体的な動作の様子を図48を
用いて説明する。
The specific operation of the conventional example will be described with reference to FIG.

【0042】図48は、本従来例の動作を示す解説図で
ある。図48に示される処理前の状況は、ヒープ領域2
内に6つのオブジェクト領域10があり、各オブジェク
ト領域10はその内部に存在するポインタ12により相
互に参照が行われており、さらに一部はヒープ領域2外
のポインタ12から参照されている。本状態に対し手順
P1401、P141、P142を行った段階が、図4
8に示される有効オブジェクト領域検索後の状況であ
り、ヒープ領域外のポインタ12からの到達可否状況に
応じて、各オブジェクト領域10のマーク20の値が
「使用中(1)」または「未使用(0)」に設定されて
いる。さらに、本状態に対し手順P143を行いガベー
ジコレクション処理が終了した段階が、図48に示され
る未使用オブジェクト領域解放後の状況であり、マーク
20が「未使用(0)」であった2つのオブジェクト領
域は、相互に循環した参照があるにも関わらず開放さ
れ、フリーリスト18の一部に組み込まれている。
FIG. 48 is an explanatory diagram showing the operation of the conventional example. The situation before the processing shown in FIG.
There are six object areas 10, and each object area 10 is mutually referred to by a pointer 12 existing therein, and a part is further referred to by a pointer 12 outside the heap area 2. FIG. 4 shows a stage where the procedures P1401, P141, and P142 are performed for this state.
8, the value of the mark 20 of each object area 10 is “in use (1)” or “unused” according to the state of reachability from the pointer 12 outside the heap area. (0) ". Further, the stage at which the procedure P143 is performed for this state and the garbage collection process is completed is a state after the release of the unused object area shown in FIG. The object area is freed despite the reciprocal references, and is part of the free list 18.

【0043】本従来例に示したマーク−スイープ方式の
ガベージコレクション処理は上記のように動作するの
で、参照カウンタ方式では回収し損ねた循環した参照の
あるオブジェクト領域10も正しく回収できる。しか
し、マーク−スイープ方式には、まだいくつかの問題が
ある。その1つは、ガベージコレクション処理は一括し
て行わなければならないことであり、参照カウンタ方式
に比べ応用プログラムの中断時間がかなり長くなるとい
う欠点がある。もう1つは、フラグメンテーションと呼
ばれる現象が発生することである。これは参照カウンタ
方式でも同様であるが、マーク−スイープ方式ではオブ
ジェクト領域は一度獲得されると開放されるまでその位
置は不変であるため、応用プログラムの動作に伴い各種
の大きさのオブジェクト領域10の獲得および開放を繰
り返していくと、ヒープ領域2内の使用可能なメモリ領
域が細分化されていき、次第に大きなオブジェクト領域
が獲得できなくなる現象である。メモリリーク現象同
様、本現象の発生は計算機システムが長期連続運転でき
ないことを意味し、長期間にわたる無定試運転が前提の
産業系計算機システムでは許容することができない。本
問題に対する対策として第4の従来例を説明する。
Since the garbage collection process of the mark-sweep method shown in the conventional example operates as described above, the object area 10 having a circulating reference that cannot be recovered by the reference counter method can be correctly recovered. However, the mark-sweep method still has some problems. One of them is that the garbage collection process must be performed collectively, and there is a drawback that the interruption time of the application program is considerably longer than that of the reference counter method. The other is that a phenomenon called fragmentation occurs. The same applies to the reference counter method. However, in the mark-sweep method, once the object area is acquired, its position remains unchanged until it is released. When the acquisition and the release of the heap area 2 are repeated, the available memory area in the heap area 2 is subdivided, and a large object area cannot be acquired gradually. Similar to the memory leak phenomenon, the occurrence of this phenomenon means that the computer system cannot be operated continuously for a long period of time, and cannot be tolerated in an industrial computer system on which the indefinite test operation over a long period is premised. As a countermeasure against this problem, a fourth conventional example will be described.

【0044】第4の従来例は、マーク−コンパクト方式
と呼ばれるガベージコレクション処理であり、これは第
3の従来例で示したマーク−スイープ方式において、フ
ラグメンテーション現象の問題を改善した方式である。
The fourth conventional example is a garbage collection process called a mark-compact method, which is a method in which the problem of the fragmentation phenomenon is improved in the mark-sweep method shown in the third conventional example.

【0045】図49は、第4の従来例である、マーク−
コンパクト方式でガベージコレクション処理を行う動的
メモリ管理機構の構成図である。図49において、動的
メモリ管理機構1、ヒープ領域2、ガベージコレクショ
ン手段5、オブジェクト領域10、ポインタ12、マー
ク20、残利用可能領域13、既獲得済み領域14は図
46と同じであるので説明を省略する。
FIG. 49 shows a fourth prior art example of a mark-
FIG. 3 is a configuration diagram of a dynamic memory management mechanism that performs garbage collection processing in a compact manner. In FIG. 49, the dynamic memory management mechanism 1, heap area 2, garbage collection means 5, object area 10, pointer 12, mark 20, remaining available area 13, and already acquired area 14 are the same as those in FIG. Is omitted.

【0046】図49に示す第4の従来例の構成と図46
に示す第3の従来例の構成との大きな違いは、第4の従
来例では残利用可能領域13内の利用可能なメモリ領域
がフリーリスト18を用いて管理されていないことであ
る。第4の実施例では、オブジェクト領域10は、メモ
リ獲得手段3によりヒープ領域の一部である残利用可能
領域13から獲得され、獲得されたオブジェクト領域1
0は既獲得済み領域14の一部を構成するようになる
が、メモリ開放手段4はガベージコレクション手段5に
組み込まれて動作し、オブジェクト領域10はメモリ開
放手段4によって個別に開放されることはなく、ガベー
ジコレクション処理の中で一括して開放される。
The structure of the fourth conventional example shown in FIG. 49 and FIG.
The major difference from the configuration of the third conventional example shown in FIG. 7 is that the available memory area in the remaining available area 13 is not managed using the free list 18 in the fourth conventional example. In the fourth embodiment, the object area 10 is acquired by the memory acquisition means 3 from the remaining available area 13 which is a part of the heap area, and the acquired object area 1
0 constitutes a part of the already acquired area 14, but the memory releasing means 4 operates by being incorporated in the garbage collection means 5, and the object area 10 is individually released by the memory releasing means 4. Instead, they are released collectively during the garbage collection process.

【0047】次に、本従来例の動作について説明する。
図50は、本従来例におけるガベージコレクション処理
(GC処理)の動作を示すフローチャートである。本従
来例におけるガベージコレクション処理は、第3の従来
例のガベージコレクション処理と同様、大きく4つの段
階を踏み、しかも最後の段階以外は同一の処理を行う。
すなわち、本従来例でも、まず最初に、既獲得済み領域
14内に存在するすべてのオブジェクト領域10のマー
ク20を「未使用」と印付け(P1401)、次にヒー
プ領域2の外部に存在するすべてのポインタ12につい
て、それらのポインタ12から直接参照されるオブジェ
クト領域10を探索し、そのマーク20を「使用中」と
印付けし(P141)、その後、既獲得済み領域14に
あってマーク20が「使用中」となっているオブジェク
ト領域10を探索し、該当するオブジェクト領域10か
ら参照されるオブジェクト領域10についてもマーク2
0を「使用中」とする(P142)。手順P141、P
142によりヒープ領域外のポインタ12から直接また
は間接に参照できるすべてのオブジェクト領域10のマ
ーク20を「使用中」としたので、本段階でマークが
「未使用」となっている既獲得済み領域14内のオブジ
ェクト領域10は「ごみ」とみなすことができる。
Next, the operation of the conventional example will be described.
FIG. 50 is a flowchart showing the operation of the garbage collection process (GC process) in the conventional example. The garbage collection process in this conventional example, as in the garbage collection process of the third conventional example, roughly takes four steps, and performs the same processing except for the last step.
That is, also in this conventional example, first, the marks 20 of all the object areas 10 existing in the already acquired area 14 are marked as “unused” (P1401), and then the marks 20 exist outside the heap area 2. With respect to all the pointers 12, the object area 10 directly referred to by the pointers 12 is searched, and the mark 20 is marked as "in use" (P141). Is searched for the object area 10 in which the object area 10 is “in use”, and the mark 2 is also set for the object area 10 referred to from the corresponding object area 10.
0 is set to “in use” (P142). Procedure P141, P
Since the marks 20 of all the object areas 10 that can be referred to directly or indirectly from the pointer 12 outside the heap area by “142” are set to “in use”, the already acquired areas 14 whose marks are “unused” at this stage The object area 10 inside can be regarded as “garbage”.

【0048】本従来例の最後の段階では、既獲得済み領
域14内でマーク20が「未使用」のオブジェクト領域
10の開放として、残利用可能領域13とマーク20が
「未使用」のオブジェクト領域10を1つにまとめ、新
たに残利用可能領域13と既獲得済み領域14を設定す
る(P151)。すなわち、まずヒープ領域2の一端を
探索開始端と定め、同探索開始端側から既獲得済み領域
14内に存在しマーク20が「使用中」のオブジェクト
領域を選択(P1511)、同オブジェクト領域10と
ヒープ領域2の探索開始端との間に空き領域があれば
(P1512のYes)、空きを無くすよう同オブジェ
クト領域10をコピーして移動し間を詰める(P151
3)。本手順を既獲得済み領域14内にあるマーク20
が「使用中」のオブジェクト領域10すべてに対して行
うことで(P1514のNo、P1515)、「使用
中」のオブジェクト領域10をヒープ領域の探索開始端
側にまとめ、ヒープ領域2のなかで、「使用中」オブジ
ェクト領域10が集まった部分を新しい既獲得済み領域
14、他の部分を残利用可能領域13とする(P151
6)。
In the last stage of this conventional example, the mark 20 is released from the object area 10 in which the mark 20 is "unused" in the already acquired area 14, and the remaining available area 13 and the mark 20 are set in the "unused" object area. 10 are combined into one, and a remaining available area 13 and an already acquired area 14 are newly set (P151). That is, first, one end of the heap area 2 is determined as a search start end, and an object area existing in the already acquired area 14 and having the mark 20 “in use” is selected from the search start end side (P1511). If there is a vacant area between the search area and the search start end of the heap area 2 (Yes in P1512), the object area 10 is copied and moved to reduce the space so as to eliminate the vacancy (P151).
3). The mark 20 in the already acquired area 14
Is performed on all the object areas 10 that are in use (No in P1514, P1515), the object areas 10 in use are collected on the search start end side of the heap area, and in the heap area 2, The portion where the "in use" object regions 10 are gathered is referred to as a new acquired region 14, and the other portions are referred to as the remaining available region 13 (P151).
6).

【0049】本従来例の具体的な動作の様子を図51を
用いて説明する。
The specific operation of the conventional example will be described with reference to FIG.

【0050】図51は、本従来例の動作を示す解説図で
ある。図51に示される処理前の状況は、既獲得済み領
域14内に6つのオブジェクト領域10があり、各オブ
ジェクト領域10はその内部に存在するポインタ12に
より相互に参照が行われており、さらに一部はヒープ領
域2外のポインタ12から参照されている。本状態に対
し手順P1401、P141、P142を行った段階
が、図51に示される有効オブジェクト領域検索後の状
況であり、ヒープ領域外のポインタ12からの到達可否
状況に応じて、各オブジェクト領域10のマーク20の
値が「使用中(1)」または「未使用(0)」に設定さ
れている。さらに、本状態に対し手順P151を行いガ
ベージコレクション処理が終了した段階が、図51に示
される未使用オブジェクト領域解放後の状況であり、マ
ーク20が「未使用(0)」であった2つのオブジェク
ト領域は、相互に循環した参照があるにも関わらず開放
され、さらにマークが「使用中(1)」のオブジェクト
領域はヒープ領域2の左端に集められ、その全体が新し
い既獲得済み領域14となり、ヒープ領域2の残りの部
分が新しい残利用可能領域13となっている。
FIG. 51 is an explanatory diagram showing the operation of the conventional example. In the situation before the processing shown in FIG. 51, there are six object areas 10 in the already-acquired area 14, and the object areas 10 are mutually referenced by the pointer 12 existing therein. The part is referred to from the pointer 12 outside the heap area 2. The state after performing the procedures P1401, P141, and P142 on this state is the state after the search for the valid object area shown in FIG. 51. Each object area 10 is determined according to the state of reachability from the pointer 12 outside the heap area. Is set to “in use (1)” or “unused (0)”. Further, the stage at which the procedure P151 is performed on this state and the garbage collection process is completed is the state after the release of the unused object area shown in FIG. 51, and the two marks whose mark 20 is “unused (0)” The object area is released in spite of the mutually circulating references, and the object area with the mark “in use (1)” is collected at the left end of the heap area 2, and the whole is a new acquired area 14. And the remaining part of the heap area 2 is a new remaining available area 13.

【0051】本従来例に示したマーク−コンパクト方式
のガベージコレクション処理は上記のように動作するの
で、第3の従来例に示したマーク−スイープ方式と異な
りフラグメンテーション現象の問題が回避される。しか
し、マーク−コンパクト方式にも、まだいくつか問題が
ある。それらはフラグメンテーション現象の発生を避け
るため、ガベージコレクション処理の中でオブジェクト
領域の移動を行っていることにより発生する問題であ
り、その1つは、オブジェクト領域の移動のために行う
領域のコピー動作は重い処理であるため、マーク−スイ
ープ方式より、さらに応用プログラムの中断時間が長く
なるという欠点である。もう1つは、オブジェクト領域
の移動P1513に伴い、移動したオブジェクト領域を
参照しているポインタ12の参照先も移動先を示すよう
補正しなければならないが、その処理が複雑になるとい
う点である。
Since the garbage collection process of the mark-compact method shown in the conventional example operates as described above, the problem of the fragmentation phenomenon is avoided unlike the mark-sweep method shown in the third conventional example. However, the mark-compact scheme still has some problems. These problems are caused by moving the object area during the garbage collection process in order to avoid the occurrence of the fragmentation phenomenon. One of the problems is that the copy operation of the area performed for moving the object area is performed. Since the processing is heavy, the interruption time of the application program is longer than that of the mark-sweep method. The other is that, with the movement P1513 of the object area, the reference destination of the pointer 12 referring to the moved object area must be corrected so as to indicate the movement destination, but the processing becomes complicated. .

【0052】次に、第5の従来例を用いて、ストップ−
コピー方式と呼ばれるガベージコレクション処理につい
て説明する。ストップ−コピー方式は第3および第4の
従来例で示したマーク−スイープ方式およびマーク−コ
ンパクト方式を更に改良した方式と位置づけられる。
Next, using the fifth conventional example, the stop-
A garbage collection process called a copy method will be described. The stop-copy method is a further improvement of the mark-sweep method and mark-compact method shown in the third and fourth conventional examples.

【0053】図52は、第5の従来例である、ストップ
−コピー方式と呼ばれるガベージコレクション処理を行
う動的メモリ管理機構の構成である。図52において、
動的メモリ管理機構1、ヒープ領域2、ガベージコレク
ション手段5、オブジェクト領域10、ポインタ12は
図49と同じであるので説明を省略する。
FIG. 52 shows the configuration of a dynamic memory management mechanism for performing a garbage collection process called a stop-copy system, which is a fifth conventional example. In FIG. 52,
The dynamic memory management mechanism 1, heap area 2, garbage collection means 5, object area 10, and pointer 12 are the same as those in FIG.

【0054】図52に示す第5の従来例の構成と図49
に示す第4の従来例の構成との違いは2つある。その1
つは、第5の従来例ではオブジェクト領域10内にマー
ク20が必要ないことである。もう1つは、第5の従来
例では残利用可能領域13および既獲得済み領域14に
代え、TO領域15およびFROM領域16がヒープ領
域2内に存在することである。TO領域15とFROM
領域16は同じ大きさの領域であり、多くの場合それぞ
れヒープ領域2の半分を占める領域として設定される。
本従来例では、メモリ獲得手段3は必ずFROM領域1
6内からオブジェクト領域10を獲得する。メモリ開放
手段4はガベージコレクション手段5に組み込まれて動
作し、オブジェクト領域10を個別に開放することはな
い。
The structure of the fifth conventional example shown in FIG. 52 and FIG.
There are two differences from the configuration of the fourth conventional example shown in FIG. Part 1
One is that the mark 20 is not required in the object area 10 in the fifth conventional example. Second, in the fifth conventional example, a TO area 15 and a FROM area 16 exist in the heap area 2 instead of the remaining available area 13 and the already acquired area 14. TO area 15 and FROM
The area 16 is an area of the same size, and is often set as an area occupying half of the heap area 2 in each case.
In this conventional example, the memory acquisition means 3 is always provided in the FROM area 1
6, an object area 10 is obtained. The memory releasing means 4 operates by being incorporated in the garbage collection means 5 and does not release the object areas 10 individually.

【0055】次に、本従来例の動作について説明する。
図53は、本従来例におけるガベージコレクション処理
(GC処理)の動作を示すフローチャートである。本従
来例におけるガベージコレクション処理は大きく3つの
段階を踏む。まず最初に、第3の従来例における手順P
141と類似した手順で、ヒープ領域2の外部に存在す
るすべてのポインタ12について、それらのポインタ1
2から直接参照されるFROM領域16内のオブジェク
ト領域10を探索し、各オブジェクト領域10をコピー
によりTO領域15に移動する(P161)。次に、T
O領域15に移動したオブジェクト領域10を探索し、
該当するオブジェクト領域10から参照されるオブジェ
クト領域10についてもコピーによりFROM領域16
からTO領域15へ移動する(P162)。手順P16
1、P162によりヒープ領域外のポインタ12から直
接または間接に参照できるすべてのオブジェクト領域1
0はTO領域15に移動したので、本段階でFROM領
域16に残るオブジェクト領域10は「ごみ」とみなす
ことができる。最後に、FROM領域16とTO領域1
5を入れ替え、新しいFROM領域16とTO領域15
と定義し直す(P1631)。この結果、手順P16
1、P162によりTO領域15に集められたオブジェ
クト領域10は、新しいFROM領域16に存在するこ
ととなり、その後メモリ獲得手段3で獲得されたオブジ
ェクト領域10と共に新しいFROM領域16内に保持
されるようになる。
Next, the operation of the conventional example will be described.
FIG. 53 is a flowchart showing the operation of the garbage collection process (GC process) in the conventional example. The garbage collection process in the conventional example roughly includes three stages. First, the procedure P in the third conventional example is described.
In a procedure similar to 141, for all the pointers 12 existing outside the heap area 2, those pointers 1
The object area 10 in the FROM area 16 which is directly referred to from the second area 2 is searched, and each object area 10 is moved to the TO area 15 by copying (P161). Next, T
The object area 10 moved to the O area 15 is searched,
The object area 10 referenced from the corresponding object area 10 is also copied from the FROM area 16.
To the TO area 15 (P162). Procedure P16
1, all object areas 1 that can be referenced directly or indirectly from the pointer 12 outside the heap area by P162
Since 0 has moved to the TO area 15, the object area 10 remaining in the FROM area 16 at this stage can be regarded as "garbage". Finally, the FROM area 16 and the TO area 1
5 and the new FROM area 16 and TO area 15
(P1631). As a result, the procedure P16
1. The object area 10 gathered in the TO area 15 by P162 will be present in the new FROM area 16 and will be retained in the new FROM area 16 together with the object area 10 acquired by the memory acquisition means 3 afterwards. Become.

【0056】つぎに、手順P161、P162の詳細を
示す。手順P161では、まずヒープ領域2外にある適
切なポインタ12の1つを選択し(P1411)、その
ポインタ12が有効でFROM領域16内にあるオブジ
ェクト領域を参照していれば(P1611のYes)、
ポインタ12が参照するオブジェクト領域10をコピー
によりTO領域15へ移動し(P1612)、本手順を
ヒープ領域2の外にあるすべてのポインタ12について
繰り返す(P1413のYes、P1414)。
Next, details of the procedures P161 and P162 will be described. In the procedure P161, first, one of the appropriate pointers 12 outside the heap area 2 is selected (P1411). If the pointer 12 is valid and refers to the object area in the FROM area 16 (Yes in P1611). ,
The object area 10 referenced by the pointer 12 is moved to the TO area 15 by copying (P1612), and this procedure is repeated for all pointers 12 outside the heap area 2 (Yes in P1413, P1414).

【0057】手順162では、TO領域15内に未処理
のオブジェクト領域10があれば(P1621のYe
s)、まず該当するオブジェクト領域10を1つ選択し
(P1622)、選択したオブジェクト領域10が内部
にポインタ12を含めば(P1313のYes)、まず
選択したオブジェクト領域10に含まれるポインタ12
の1つを選び(P1314)、その値が有効で参照先オ
ブジェクト領域10がFROM領域16内に存在してい
れば(P1611のYes)、参照先のオブジェクト領
域10をコピーによりTO領域15へ移動し処理対象へ
加え(P1612)、本手順を選択したオブジェクト領
域10の内部に含まれるすべてのポインタ12に繰り返
し行い(P1315のNo)、さらにTO領域15内の
オブジェクト領域10のすべてについて上記手順を繰り
返す(P1623のNo)。
In step 162, if there is an unprocessed object area 10 in the TO area 15 (Ye of P1621)
s) First, one corresponding object area 10 is selected (P1622). If the selected object area 10 includes the pointer 12 therein (Yes in P1313), first, the pointer 12 included in the selected object area 10 is selected.
Is selected (P1314), and if the value is valid and the reference object area 10 exists in the FROM area 16 (Yes in P1611), the reference object area 10 is moved to the TO area 15 by copying. This procedure is repeated for all the pointers 12 included in the selected object area 10 (No in P1315), and the above procedure is repeated for all the object areas 10 in the TO area 15. Repeat (No in P1623).

【0058】本従来例の具体的な動作の様子を図54を
用いて説明する。
The specific operation of the conventional example will be described with reference to FIG.

【0059】図54は、本従来例の動作を示す解説図で
ある。図54に示される処理前の状況は、ヒープ領域2
内のFROM領域16内に6つのオブジェクト領域10
があり、各オブジェクト領域10はその内部に存在する
ポインタ12により相互に参照が行われており、さらに
一部はヒープ領域2外のポインタ12から参照されてい
る。本状況に対し手順P161を行った段階が、図54
に示されるヒープ領域外から参照されるオブジェクト領
域を移動した状況であり、ヒープ領域外のポインタ12
が参照していた2つのオブジェクト領域10がFORM
領域16からTO領域15へコピーにより移動してい
る。さらに、本状態に対し手順P162を行った段階
が、図54に示されるTO領域から参照されるオブジェ
クト領域を移動した状況であり、前段階でTO領域に移
動した2つのオブジェクト領域10から参照されるオブ
ジェクト領域10が新たにTO領域へ移動している。さ
らに、本状態に対し手順P1631を行いガベージコレ
クション処理が終了した段階が、図54に示されるTO
領域とFROM領域の入れ替え後の状況であり、前段階
のFROM領域16が新たなTO領域15になることで
「ごみ」であったオブジェクト領域10の占めるメモリ
領域は回収、再利用可能となる。
FIG. 54 is an explanatory diagram showing the operation of the conventional example. The situation before the processing shown in FIG.
6 object areas 10 in the FROM area 16
Each object area 10 is mutually referred to by a pointer 12 existing inside the object area 10, and a part is further referred to by a pointer 12 outside the heap area 2. The stage at which the procedure P161 was performed for this situation is shown in FIG.
In the situation where the object area referred to from outside the heap area shown in FIG.
The two object areas 10 referred to by
It is moved from the area 16 to the TO area 15 by copying. Further, the stage in which the procedure P162 is performed for this state is a situation in which the object region referred to from the TO region shown in FIG. 54 has been moved, and is referred to from the two object regions 10 moved to the TO region in the previous stage. Object area 10 has newly moved to the TO area. Further, the stage at which the procedure P1631 is performed on this state and the garbage collection process ends is indicated by TO TO shown in FIG.
This is the situation after the exchange of the area and the FROM area, and the memory area occupied by the "garbage" object area 10 can be collected and reused because the FROM area 16 in the previous stage becomes the new TO area 15.

【0060】本従来例に示したストップ−コピー方式の
ガベージコレクション処理は上記のように動作するの
で、第4の従来例に示したマーク−コンパクト方式に比
べると「生きている」オブジェクト領域と「ごみ」の区
別のために全オブジェクト領域を検索する必要がなく、
その処理時間が速いという利点がある。さらに、次の第
6の従来例を併用することで、オブジェクト領域の移動
に伴い移動したオブジェクト領域を参照するポインタ1
2の補正処理が、マーク−コンパクト方式より容易にで
きるという利点がある。ただし、最大でもヒープ領域2
の半分の大きさまでしか利用ができないため、メモリ利
用効率が低いという欠点がある。
Since the garbage collection process of the stop-copy method shown in the conventional example operates as described above, the "living" object area and the "live" object area are compared with the mark-compact method shown in the fourth conventional example. There is no need to search the entire object area to distinguish "garbage",
There is an advantage that the processing time is fast. Further, by using the following sixth conventional example together, the pointer 1 that refers to the object area moved with the movement of the object area can be obtained.
2 has an advantage that the correction processing can be performed more easily than the mark-compact method. However, at most heap area 2
Since it can be used only up to half the size of the above, there is a disadvantage that the memory utilization efficiency is low.

【0061】図55は、第6の従来例を示す構成図であ
る。図55においてヒープ領域2、TO領域15、FR
OM領域16、ポインタ12は図52と同じであるので
説明を省略する。また、図55では第6の従来例の説明
に不要な動的メモリ管理機構1、メモリ獲得手段3、メ
モリ開放手段4、ガベージコレクション手段5は記述を
省略している。
FIG. 55 is a configuration diagram showing a sixth conventional example. In FIG. 55, heap area 2, TO area 15, FR
The OM area 16 and the pointer 12 are the same as those in FIG. In FIG. 55, the description of the dynamic memory management mechanism 1, the memory acquisition unit 3, the memory release unit 4, and the garbage collection unit 5, which are unnecessary for the description of the sixth conventional example, is omitted.

【0062】図55に示される第6の従来例の構成と図
52に示される第5の従来例の構成の大きな違いは、第
6の従来例ではオブジェクト領域10の内部に新たに間
接ポインタ22が存在することである。第6の従来例で
は、プログラムは、ポインタ12が保持する情報と間接
ポインタ22が保持する情報の、両方を用いてオブジェ
クト領域10を参照する。具体的には、プログラムは、
まずポインタ12が保持する情報を元に仮のオブジェク
ト領域10を参照し、その後同オブジェクト領域10の
保持する間接ポインタ22の値を元に真のオブジェクト
領域10を参照する。
The major difference between the structure of the sixth conventional example shown in FIG. 55 and the structure of the fifth conventional example shown in FIG. 52 is that the indirect pointer 22 is newly added inside the object area 10 in the sixth conventional example. Is to exist. In the sixth conventional example, the program refers to the object area 10 using both the information held by the pointer 12 and the information held by the indirect pointer 22. Specifically, the program
First, the temporary object area 10 is referred to based on the information held by the pointer 12, and then the true object area 10 is referred to based on the value of the indirect pointer 22 held in the object area 10.

【0063】本従来例の具体的な動作の様子を図55を
用いて説明する。図55では、ヒープ領域外にポインタ
Rpが、またヒープ領域2内には3つのオブジェクト領
域A、B、Cが存在する。ヒープ領域外に存在するポイ
ンタRpは、オブジェクト領域Aを参照している。オブ
ジェクト領域Aは、その内部にポインタAp1及びポイ
ンタAp2を保持し、ポインタAp1はオブジェクト領
域Bを、またポインタAp2はオブジェクト領域Cを参
照している。オブジェクト領域Bは、その内部にポイン
タBp1およびポインタBp2を保持し、ポインタBp
1はオブジェクト領域Cを参照しているが、ポインタB
p2はいずれのオブジェクト領域も参照せず無効な値を
保持している。図55は、また、ストップ−コピー方式
のガベージコレクション処理の途中段階を示しており、
オブジェクト領域A及びオブジェクト領域CはFROM
領域16からTO領域15へコピーにより移動している
が、オブジェクト領域BはまだFROM領域16からT
O領域15へ移動していない。
The specific operation of the conventional example will be described with reference to FIG. In FIG. 55, a pointer Rp exists outside the heap area, and three object areas A, B, and C exist in the heap area 2. The pointer Rp existing outside the heap area refers to the object area A. The object area A holds therein the pointers Ap1 and Ap2. The pointer Ap1 refers to the object area B, and the pointer Ap2 refers to the object area C. The object area B holds a pointer Bp1 and a pointer Bp2 therein, and a pointer Bp
1 refers to the object area C, but the pointer B
p2 holds an invalid value without referring to any object area. FIG. 55 also shows an intermediate stage of the stop-copy garbage collection process,
Object area A and object area C are FROM
Although the area 16 has been moved from the area 16 to the TO area 15 by copying, the object area B is still moved from the FROM area 16 to the T area.
It has not moved to the O region 15.

【0064】オブジェクト領域10内の間接ポインタ2
2は、ガベージコレクション処理において、それぞれ真
のオブジェクト領域10を参照するように調整される。
ここで真のオブジェクト領域とは、まだFROM領域1
6内にありTO領域15へ移動していないオブジェクト
領域では、FROM領域にあるオブジェクト領域であ
り、FROM領域からTO領域に移動したオブジェクト
領域では、TO領域に存在する移動先のオブジェクト領
域である。図55では、FROM領域にあるオブジェク
ト領域Bと、TO領域にあるオブジェクト領域A(新)
及びオブジェクト領域C(新)が該当し、それらのオブ
ジェクト領域の内部の間接ポインタ22は、自身のオブ
ジェクト領域を参照するように設定される。一方、仮の
オブジェクト領域はFROM領域からTO領域にオブジ
ェクト領域が移動した場合の、元のオブジェクト領域で
あり、図55ではFROM領域に残されたオブジェクト
領域A(旧)及びオブジェクト領域C(旧)が該当し、
それらのオブジェクト領域の内部の間接ポインタ22
は、それぞれ対応するTO領域の移動先のオブジェクト
領域を参照するよう設定される。本設定はオブジェクト
領域をFROM領域からTO領域へ移動する手順P16
12において、移動前のオブジェクト領域の間接ポイン
タ22を移動先のオブジェクト領域を参照するよう変更
することで実現される。
Indirect pointer 2 in object area 10
2 is adjusted so as to refer to the true object area 10 in the garbage collection process.
Here, the true object area is still the FROM area 1
The object area within 6 and not moved to the TO area 15 is an object area in the FROM area, and the object area moved from the FROM area to the TO area is an object area existing in the TO area. In FIG. 55, the object area B in the FROM area and the object area A in the TO area (new)
And the object area C (new), and the indirect pointer 22 inside the object area is set so as to refer to its own object area. On the other hand, the temporary object area is the original object area when the object area moves from the FROM area to the TO area. In FIG. 55, the object area A (old) and the object area C (old) left in the FROM area are shown. Applies,
Indirect pointer 22 inside those object areas
Are set so as to refer to the object areas to which the corresponding TO areas are moved. This setting is a procedure P16 for moving the object area from the FROM area to the TO area.
In step 12, this is realized by changing the indirect pointer 22 of the object area before the movement to refer to the object area of the movement destination.

【0065】本従来例は以上のように動作するので、比
較的単純なFROM領域からTO領域への移動時のオブ
ジェクトの参照関係の調整処理と、ポインタからオブジ
ェクトの参照処理で、TO領域へ移動したオブジェクト
からTO領域へ移動したオブジェクト領域の参照も、T
O領域へ移動したオブジェクトからFROM領域内のま
だ移動していないオブジェクト領域の参照も、FROM
領域のまだ移動してないオブジェクト領域からTO領域
の移動したオブジェクト領域への参照も、すべて等しく
同じ手順で扱えるという利点がある。すなわち、図55
において、オブジェクト領域A(新)のポインタAp2
からオブジェクト領域C(新)へは、まずポインタAp
2からオブジェクト領域C(新)を参照し、さらにオブ
ジェクト領域C(新)からその間接ポインタ22が指す
先であるオブジェクト領域C(新)を再度参照すること
で、正しくなされる。また、オブジェクト領域A(新)
のポインタAp1からオブジェクト領域Bへは、まずポ
インタAp1からオブジェクト領域Bを参照し、さらに
オブジェクト領域Bからその間接ポインタ22が指す先
であるオブジェクト領域Bを再度参照することで正しく
なされる。そして、オブジェクト領域BのポインタBp
1からオブジェクト領域C(新)へは、まずポインタB
p1からオブジェクト領域C(旧)を参照し、さらにオ
ブジェクト領域C(旧)からその間接ポインタ22が指
す先であるオブジェクト領域C(新)を参照することで
正しくなされる。
Since the prior art operates as described above, the process of adjusting the reference relationship of the object when moving from the relatively FROM region to the TO region and the process of referencing the object from the pointer move to the TO region. The reference of the object area moved from the object to the TO area
Reference from the object moved to the O area to the object area in the FROM area that has not yet moved is also performed from the FROM area.
There is an advantage that all references from an object area that has not yet moved to an object area that has moved the TO area can be equally handled in the same procedure. That is, FIG.
, The pointer Ap2 of the object area A (new)
From the pointer to the object area C (new)
2, the object area C (new) is referred to, and the object area C (new) to which the indirect pointer 22 points is referred to again from the object area C (new). Object area A (new)
The pointer Ap1 to the object area B can be correctly obtained by first referring to the object area B from the pointer Ap1, and further referring to the object area B to which the indirect pointer 22 points from the object area B. Then, the pointer Bp of the object area B
1 to the object area C (new)
This is correctly performed by referring to the object area C (old) from p1 and further referring to the object area C (new) to which the indirect pointer 22 points from the object area C (old).

【0066】ただし、以上に示した本従来例は、オブジ
ェクト領域の移動に際し移動前の領域が破壊されないこ
とが必要である。このため第5の従来例により示したF
ROM領域からTO領域へ移動させるストップ−コピー
方式に組み合わせることはできるが、第4の従来例によ
り示したヒープ領域内で空きを埋めるように移動させる
マーク−コンパクト方式に組み合わせることは困難であ
り、本従来例はマーク−コンパクト方式におけるオブジ
ェクト領域の移動に伴う参照関係の保持の解決策とはな
らない。
However, in the conventional example described above, it is necessary that the area before the movement is not destroyed when the object area is moved. For this reason, F shown in the fifth prior art example
Although it can be combined with the stop-copy method in which the data is moved from the ROM area to the TO area, it is difficult to combine with the mark-compact method in which the data is moved so as to fill the space in the heap area shown in the fourth conventional example. This conventional example does not provide a solution for maintaining a reference relationship accompanying movement of an object area in the mark-compact system.

【0067】次に、第7の従来例を用いて、インクリメ
ンタル(歩進)方式のガベージコレクション処理につい
て説明する。インクリメンタル方式は、ガベージコレク
ション処理を少しずつ進めることで応用プログラムの中
断時間を短くし、プログラムの応答性の向上を図る技術
であり、各種のガベージコレクション方式をベースとし
て多くの改良がなされているが、ここでは、第5の従来
例として示したストップ−コピー方式を元に改良した比
較的単純な方式について説明する。
Next, the garbage collection processing of the incremental (stepping) method will be described using a seventh conventional example. The incremental method is a technology that improves the responsiveness of the program by shortening the interruption time of the application program by advancing the garbage collection process little by little, and many improvements have been made based on various garbage collection methods. Here, a relatively simple system improved based on the stop-copy system shown as the fifth conventional example will be described.

【0068】第7の従来例の構成およびガベージコレク
ション処理の動作は、それぞれ第5の従来例の構成(図
52)及びガベージコレクション処理の動作(図53)
と同一であるので、説明を省略する。第7の従来例にお
けるポインタの値の読み出しの動作を図56を用いて説
明する。
The configuration of the seventh conventional example and the operation of the garbage collection process are respectively the same as the configuration of the fifth conventional example (FIG. 52) and the operation of the garbage collection process (FIG. 53).
Therefore, the description is omitted. An operation of reading a pointer value in the seventh conventional example will be described with reference to FIG.

【0069】図56は、第7の従来例の動作を示すフロ
ーチャートである。ポインタの値の読み出しの動作で
は、ポインタ12の値が有効であり(P1201のYe
s)、さらにポインタ12の参照するオブジェクト領域
10がFROM領域16にあれば(P1611のYe
s)、参照先のオブジェクト領域10をFROM領域1
6からTO領域15へ移動させ(P1612)、移動先
への参照をポインタ12の値に設定してから(P170
1)、その値をプログラムに渡し(P1702)、処理
を終える。なお、ポインタ12の参照先がTO領域のオ
ブジェクト領域であったり(P1611のNo)、ある
いは値が無効である場合は(P1201のNo)、速や
かに手順P1702に移りその値をそのままプログラム
に渡す。
FIG. 56 is a flowchart showing the operation of the seventh conventional example. In the operation of reading the value of the pointer, the value of the pointer 12 is valid (Ye of P1201).
s), if the object area 10 referred to by the pointer 12 is in the FROM area 16 (Ye in P1611)
s), the object area 10 of the reference destination is stored in the FROM area 1
6 to the TO area 15 (P1612), and set the reference to the destination to the value of the pointer 12 (P170).
1) The value is passed to the program (P1702), and the process ends. If the reference destination of the pointer 12 is the object area in the TO area (No in P1611) or the value is invalid (No in P1201), the process immediately proceeds to the procedure P1702 and the value is passed to the program as it is.

【0070】本従来例に示したストップ−コピー方式を
元にしたインクリメンタル方式のガベージコレクション
は、上記のように動作することで、ガベージコレクショ
ン処理P160と応用プログラムの動作を平行して行う
ことが可能となり、これによりストップ−コピー方式の
長所を損ねることなく、第2の従来例として示した参照
カウンタ方式のガベージコレクション処理と同様に応用
プログラムの動作の中断を短くすることができる。ただ
し、オブジェクト領域のコピー処理が入るため、参照カ
ウンタ方式に比較すると応用プログラムの動作の中断時
間は長い。
In the incremental garbage collection based on the stop-copy method shown in the conventional example, the garbage collection process P160 and the operation of the application program can be performed in parallel by operating as described above. As a result, the interruption of the operation of the application program can be shortened similarly to the garbage collection processing of the reference counter method shown as the second conventional example without impairing the advantages of the stop-copy method. However, since the copy process of the object area is included, the interruption time of the operation of the application program is longer than that of the reference counter method.

【0071】次に、第8の従来例を用いて、ジェネレー
ショナル(世代)方式のガベージコレクション処理につ
いて説明する。ジェネレーショナル方式は、ガベージコ
レクション処理の対象とするオブジェクト領域に「世
代」の概念を導入し、世代の異なるオブジェクト領域を
分けて扱うことで、平均的なガベージコレクション処理
の効率を図る技術である。ジェネレーショナル方式のイ
ンクリメンタル方式同様、各種のガベージコレクション
方式をベースとして多くの改良がなされているが、ここ
では比較的単純だが第4の従来例として示したマーク−
コンパクト方式と第5の従来例として示したストップ−
コピー方式を併用する方式について説明する。
Next, a garbage collection process of a generational (generation) system will be described using an eighth conventional example. The generational method is a technology that introduces the concept of “generation” into object areas to be subjected to garbage collection processing, and separates and treats object areas of different generations to improve the efficiency of average garbage collection processing. Like the incremental method of the generational method, many improvements have been made based on various garbage collection methods. Here, the mark shown as a fourth conventional example is relatively simple.
Stop shown as compact system and fifth conventional example
A method using the copy method together will be described.

【0072】図57は、第8の従来例である、マーク−
コンパクト方式とストップ−コピー方式を併用したジェ
ネレーショナル方式のガベージコレクション処理を行う
動的メモリ管理機構の構成図である。図57において、
動的メモリ管理機構1、ヒープ領域2、メモリ獲得手段
3、メモリ開放手段4、ガベージコレクション5、ポイ
ンタ12、TO領域15、FROM領域16は図52と
同じであるので説明を省略する。また、オブジェクト領
域10、マーク20は図49と同じであるので説明を省
略する。図57ではヒープ領域2内には、TO領域1
5、FROM領域16のほかに、OLD領域23が存在
する。TO領域15、FROM領域16、OLD領域2
3は同じ大きさの領域であり、多くの場合それぞれヒー
プ領域2の3等分した領域として設定される。本従来例
では、第5の従来例同様、メモリ獲得手段3は必ずFR
OM領域16内からオブジェクト領域10を獲得し、メ
モリ開放手段4はガベージコレクション手段5に組み込
まれて動作し、オブジェクト領域10を個別に開放する
ことはない。
FIG. 57 shows an eighth conventional example, in which a mark-
FIG. 11 is a configuration diagram of a dynamic memory management mechanism that performs a garbage collection process of a generational system using both a compact system and a stop-copy system. In FIG. 57,
The dynamic memory management mechanism 1, the heap area 2, the memory acquisition means 3, the memory release means 4, the garbage collection 5, the pointer 12, the TO area 15, and the FROM area 16 are the same as those in FIG. Since the object area 10 and the mark 20 are the same as those in FIG. 49, the description is omitted. In FIG. 57, TO area 1 is included in heap area 2.
5. In addition to the FROM area 16, there is an OLD area 23. TO area 15, FROM area 16, OLD area 2
3 is an area of the same size, and is set as an area divided into three equal parts of the heap area 2 in many cases. In this conventional example, as in the fifth conventional example, the memory acquisition means 3 is always FR
The object area 10 is acquired from the OM area 16, and the memory releasing means 4 operates by being incorporated in the garbage collection means 5, and does not individually release the object area 10.

【0073】次に、本従来例の動作について説明する。
本従来例ではオブジェクト領域の世代を若い世代と古い
世代の2つに分ける。若い世代のオブジェクト領域はF
ROM領域に存在する。古い世代のオブジェクト領域は
OLD領域に存在する。まず最初に、若い世代に関する
ガベージコレクションについて説明する。
Next, the operation of the conventional example will be described.
In this conventional example, the generation of the object area is divided into a young generation and an old generation. The young generation object area is F
It exists in the ROM area. The old generation object area exists in the OLD area. First, garbage collection for the young generation will be described.

【0074】図58は、本従来例における第1の動作で
ある、若い世代に対するガベージコレクション処理(G
C処理)の動作を示すフローチャートである。本従来例
では、若い世代に対するガベージコレクション処理は第
5の従来例に示したストップ−コピー方式に準じて行わ
れ、まずOLD領域23にある古いオブジェクト領域に
含まれるポインタ12を、ヒープ領域外にあるように扱
うようにし(P1801)、ついでFROM領域16か
らTO領域15へストップ−コピー式の手順P161お
よびP162に準じた方法でガベージコレクション処理
を行う(P1802)。その後、FROM領域16とT
O領域15を入れ替え新しいFROM領域16とTO領
域15に定義し直す(P1631)。
FIG. 58 shows a garbage collection process (G
9 is a flowchart showing the operation of (C process). In this conventional example, the garbage collection process for the young generation is performed according to the stop-copy method shown in the fifth conventional example. First, the pointer 12 included in the old object area in the OLD area 23 is moved out of the heap area. The garbage collection process is performed in a certain manner (P1801), and a garbage collection process is performed from the FROM area 16 to the TO area 15 by a method according to the stop-copy type procedures P161 and P162 (P1802). Then, the FROM area 16 and T
The O area 15 is replaced and the new FROM area 16 and the TO area 15 are defined again (P1631).

【0075】本従来例の若い世代に対するガベージコレ
クション処理の具体的な動作の様子を図59を用いて説
明する。
The specific operation of the garbage collection process for the young generation of the prior art will be described with reference to FIG.

【0076】図59は、本従来例の第1の動作である、
若い世代に対するガベージコレクション処理の動作を示
す解説図である。図59に示される処理前の状況は、ヒ
ープ領域2内のFROM領域16およびOLD領域23
内にのみオブジェクト領域10が存在し、その一部はヒ
ープ領域2外のポインタ12から参照されている。本状
態に対し、手順P1801、P1802を行った段階
が、図59に示される処理後の状況であり、OLD領域
23内に存在していたオブジェクト領域10は変化して
いないが、FROM領域16内に存在していたオブジェ
クト領域10はTO領域15に移され、ヒープ領域2外
のポインタ12の参照もTO領域内を指すよう変更され
ている。なお、図59に示される処理前の状況におい
て、FROM領域16内にあって、ヒープ領域2外のポ
インタ12からも、OLD領域23内のオブジェクト領
域23が保持するポインタ12からも、直接、ないし間
接的に参照することができなかったオブジェクト領域1
0は、図59に示される処理後の状況におけるTO領域
15へは移されず、「ごみ」として回収、再利用され
る。
FIG. 59 shows a first operation of the conventional example.
It is an explanatory view showing operation of garbage collection processing to a young generation. The situation before the processing shown in FIG. 59 is based on the FROM area 16 and the OLD area 23 in the heap area 2.
The object area 10 exists only within the heap area 2, and a part thereof is referred to by the pointer 12 outside the heap area 2. The stage at which the procedures P1801 and P1802 are performed with respect to this state is the state after the processing shown in FIG. 59. The object area 10 existing in the OLD area 23 has not changed, but the Has been moved to the TO area 15 and the reference of the pointer 12 outside the heap area 2 has been changed to point to the inside of the TO area. In the situation before the processing shown in FIG. 59, the pointer 12 in the FROM area 16 outside the heap area 2 and the pointer 12 held in the object area 23 in the OLD area 23 directly or Object area 1 that could not be referenced indirectly
0 is not moved to the TO area 15 in the situation after the processing shown in FIG. 59, but is collected and reused as “garbage”.

【0077】次に、本従来例の第2の動作である、古い
世代のガベージコレクション処理について説明する。図
60は、本従来例の第2の動作である、古い世代に対す
るガベージコレクション処理の動作を示すフローチャー
トである。本従来例では、古い世代に対するガベージコ
レクション処理は第4の従来例に示したマーク−コンパ
クト方式に準じて行われ、まずTO領域15内にオブジ
ェクト領域10があれば、同オブジェクト領域10に含
まれるポインタ12を、ヒープ領域外にあるように扱う
ようにし(P1901)、ついでFROM領域16とO
LD領域23を合わせて1つの領域とみなしOLD領域
23から優先して詰めるようにマーク−コンパクト式の
手順P140に準じた方法でガベージコレクション処理
を行う(P1902)。
Next, the garbage collection process of the old generation, which is the second operation of the conventional example, will be described. FIG. 60 is a flowchart showing the operation of the garbage collection process for the old generation, which is the second operation of the conventional example. In this conventional example, the garbage collection process for the old generation is performed in accordance with the mark-compact method shown in the fourth conventional example. First, if the object area 10 exists in the TO area 15, it is included in the object area 10. The pointer 12 is handled as if it is outside the heap area (P1901).
The garbage collection process is performed by a method in accordance with the mark-compact procedure P140 so that the LD region 23 is regarded as one region and the OLD region 23 is preferentially packed (P1902).

【0078】本従来例の古い世代に対するガベージコレ
クション処理の具体的な動作の様子を図61を用いて説
明する。
The specific operation of the garbage collection process for the old generation of the prior art will be described with reference to FIG.

【0079】図61は、本従来例の第2の動作である、
古い世代に対するガベージコレクション処理の動作を示
す解説図である。図61に示される処理前の状況は、図
59に示される処理前の状況と同様に、ヒープ領域2内
のFROM領域16およびOLD領域23内にのみオブ
ジェクト領域10が存在し、その一部はヒープ領域2外
のポインタ12から参照されている。本状態に対し、手
順P1901、P1902を行った段階が、図61に示
される処理後の状況であり、OLD領域23内に存在し
ていたオブジェクト領域10とFROM領域に存在して
いたオブジェクト領域のうち、ヒープ領域2外のポイン
タ12から直接ないし間接的に参照することができなか
ったオブジェクト領域10は省かれ、残ったオブジェク
ト領域10はOLD領域23を先に詰めるようにまとめ
られ、これにより「ごみ」は回収、再利用される。なお
オブジェクト領域をまとめる際には、FROM領域16
とOLD領域23の境界をオブジェクト領域10がまた
ぐことはないようにする。なお、図61に示される処理
後の状況では、古いオブジェクト領域に対するガベージ
コレクション処理の結果、生き残ったオブジェクト領域
はOLD領域23に収まりきれず、一部FROM領域1
6にも存在している。このFROM領域16に存在する
オブジェクト領域は、新しい世代に対するガベージコレ
クション処理に加わることになる。一方、OLD領域2
3に収まったオブジェクト領域は、プログラムの動作に
よってどのポインタからも参照できない「ごみ」になっ
ても、図59に示したように、新しい世代に対するガベ
ージコレクション処理では、回収、再利用されることは
ない。
FIG. 61 shows a second operation of the conventional example.
It is an explanatory view showing operation of garbage collection processing to an old generation. The situation before the processing shown in FIG. 61 is similar to the situation before the processing shown in FIG. 59, in which the object area 10 exists only in the FROM area 16 and the OLD area 23 in the heap area 2, and a part of the object area 10 It is referenced from the pointer 12 outside the heap area 2. The state after performing the procedures P1901 and P1902 with respect to this state is the state after the processing shown in FIG. 61, in which the object area 10 existing in the OLD area 23 and the object area existing in the FROM area are compared. Of these, the object area 10 that could not be directly or indirectly referred to from the pointer 12 outside the heap area 2 is omitted, and the remaining object areas 10 are grouped so that the OLD area 23 is packed first. Garbage is collected and reused. When the object areas are put together, the FROM area 16
And the OLD area 23 are not straddled by the object area 10. In the situation after the processing shown in FIG. 61, as a result of the garbage collection processing on the old object area, the surviving object area cannot be completely contained in the OLD area 23, and a part of the FROM area 1
6 also exists. The object area existing in the FROM area 16 participates in a garbage collection process for a new generation. On the other hand, OLD region 2
Even if the object area in 3 becomes “garbage” that cannot be referenced from any pointer due to the operation of the program, as shown in FIG. 59, it is not possible to collect and reuse the object area in the garbage collection process for the new generation. Absent.

【0080】本従来例に示したジェネレーショナル方式
のガベージコレクション処理は、上記のように動作する
ので、新しい世代のガベージコレクション処理とも古い
世代のガベージコレクション処理ともヒープ領域2の全
体より小さな領域を対象に動作するため、その処理時間
を短くすることができる。また、過去に示されたガベー
ジコレクション処理に関する研究成果によれば、一般的
に多くのプログラムの動作では、新しく生成されたオブ
ジェクト領域10ほど早く「ごみ」になり易く、逆に一
定時間以上「生きている」オブジェクト領域10は「ご
み」になりにくいという傾向が観察されており、本傾向
が成立する状況では、OLD領域23に収まるオブジェ
クト領域は長生きである可能性が高いので、大抵の場
合、新しい世代のガベージコレクション処理のみであっ
ても全体に対したガベージコレクション処理に近い効果
を期待でき、処理の効率が向上する。さらに、本従来例
では、最大ヒープメモリ領域の2/3まで利用でき、第
5の従来例として示したストップ−コピー方式よりメモ
リの使用効率が向上する長所がある。しかし、本従来例
に限らず一般にジェネレーショナル方式のガベージコレ
クション処理では、若い世代に対するガベージコレクシ
ョン処理と古い世代に対するガベージコレクション処理
をどのような比率で、またどのようなタイミングで行う
かという問題点があり、またそもそもジェネレーショナ
ル方式は一般的なプログラムにおける平均的な効率の向
上を図るものであるため、プログラムの挙動の傾向が前
述とは異なりオブジェクト領域の生存期間に関する前提
が崩れる場合では、得られる効果は少ないか、逆に悪化
するという問題もある。
Since the generational garbage collection process shown in the conventional example operates as described above, both the new generation garbage collection process and the old generation garbage collection process target an area smaller than the entire heap area 2. , The processing time can be shortened. In addition, according to research results on garbage collection processing shown in the past, generally, in the operation of many programs, the newly generated object area 10 tends to become “garbage” earlier, and conversely, “live” for a certain time or longer. It has been observed that the object area 10 is less likely to become "garbage", and in the situation where this tendency is established, the object area that fits in the OLD area 23 is likely to be long-lived. Even with only a new generation of garbage collection processing, an effect similar to garbage collection processing for the whole can be expected, and processing efficiency is improved. Furthermore, in this conventional example, up to 2/3 of the maximum heap memory area can be used, and there is an advantage that the memory use efficiency is improved as compared with the stop-copy method shown as the fifth conventional example. However, in general garbage collection processing of not only this conventional example but also the generational garbage collection processing, there is a problem in what ratio and at what timing garbage collection processing for the young generation and garbage collection processing for the old generation are performed. Yes, and in the first place, the generational method aims to improve the average efficiency of general programs, so it can be obtained if the tendency of the program behavior is different from the above and the assumption about the lifetime of the object area is broken There is also a problem that the effect is small or worse.

【0081】[0081]

【発明が解決しようとする課題】上述したような従来の
動的メモリ管理機構では、メモリリーク現象や、フラグ
メンテーション現象などを引き起こし、計算機システム
が長期連続運転できないことを意味し、長期間にわたる
無停止運転が前提の産業系計算機システムでは許容する
ことができない等の問題点があった。
The conventional dynamic memory management mechanism as described above causes a memory leak phenomenon, a fragmentation phenomenon, and the like, meaning that the computer system cannot be operated continuously for a long period of time. There is a problem that it cannot be tolerated in an industrial computer system that is premised on operation.

【0082】この発明は、前述した問題点を解決するた
めになされたもので、主に産業分野で使われる計算機シ
ステムに向けた、長期間の連続運転が可能で、処理が簡
素でその効率が良く、また応用プログラムの動作の応答
性や計算機システムの応答性を高められ、さらにシステ
ム立ち上げに要する時間を短縮する効果のある、ガベー
ジコレクション手段を備えた動的メモリ管理機構を得る
ことを目的とする。
The present invention has been made in order to solve the above-mentioned problems, and enables continuous operation for a long period of time mainly for a computer system used in the industrial field, is simple in processing, and has low efficiency. The objective is to obtain a dynamic memory management mechanism with garbage collection means that can improve the responsiveness of the operation of application programs and the responsiveness of the computer system, and also has the effect of shortening the time required for system startup. And

【0083】[0083]

【課題を解決するための手段】この発明に係る動的メモ
リ管理機構は、ヒープ領域と、前記ヒープ領域からその
一部をオブジェクト領域として獲得するメモリ獲得手段
と、前記獲得したオブジェクト領域を前記ヒープ領域に
戻し再利用可能とするメモリ開放手段と、前記メモリ獲
得手段により獲得されたがプログラムから利用されなく
なったオブジェクト領域を探索し、前記メモリ開放手段
を用いて前記ヒープ領域へ開放するガベージコレクショ
ン手段とを備え、前記各オブジェクト領域にはそれぞ
れ、その利用状況を示す参照カウンタが存在し、各参照
カウンタは対応するオブジェクト領域を参照するポイン
タの数を示すようその値が増減し、前記ガベージコレク
ション手段は、前記参照カウンタの値が0となったとき
対応するオブジェクト領域を開放する参照カウンタ方式
のガベージコレクション処理と、他の方式によるガベー
ジコレクション処理を併用して動作する場合に、前記参
照カウンタの値が0になり対応する第1のオブジェクト
領域が開放される際に、前記第1のオブジェクト領域の
み開放し、前記第1のオブジェクト領域内にある1ない
複数のポインタが参照している第2のオブジェクト領域
については、参照カウンタの値の更新処理および同処理
に付随して発生しうるオブジェクト領域の開放処理を行
わないものである。
A dynamic memory management mechanism according to the present invention comprises: a heap area; memory acquisition means for acquiring a part of the heap area from the heap area as an object area; Memory releasing means for returning to an area and being reusable; garbage collection means for searching for an object area acquired by the memory acquiring means but no longer used by the program, and releasing the object area to the heap area using the memory releasing means Wherein each of the object areas has a reference counter indicating its use status, and each of the reference counters increases or decreases to indicate the number of pointers referring to the corresponding object area, and the garbage collection means Is the object corresponding to when the value of the reference counter becomes 0. When the garbage collection processing of the reference counter method for releasing an area and the garbage collection processing of another method are operated together, when the value of the reference counter becomes 0 and the corresponding first object area is released. In addition, only the first object area is released, and for the second object area referenced by a plurality of one or more pointers in the first object area, the reference counter value updating processing and the same processing are performed. This does not perform the process of releasing the object area that may occur in association with it.

【0084】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、前記参照カウン
タの値が0となって前記第1のオブジェクト領域を開放
するときに、前記第1のオブジェクトの領域内にある1
ないし複数のポインタの値を無効値に設定するものであ
る。
In the dynamic memory management mechanism according to the present invention, when the garbage collection means releases the first object area when the value of the reference counter becomes 0, 1 in the area
Or setting the values of a plurality of pointers to invalid values.

【0085】この発明に係る動的メモリ管理機構は、ヒ
ープ領域と、前記ヒープ領域からその一部をオブジェク
ト領域として獲得するメモリ獲得手段と、前記獲得した
オブジェクト領域を前記ヒープ領域に戻し再利用可能と
するメモリ開放手段と、前記メモリ獲得手段により獲得
されたがプログラムから利用されなくなったオブジェク
ト領域を探索し、前記メモリ開放手段を用いて前記ヒー
プ領域へ開放するガベージコレクション手段とを備え、
前記メモリ獲得手段は、前記ヒープ領域内の残利用可能
領域の一端から順次オブジェクト領域を獲得し、前記ガ
ベージコレクション手段は、まず前記残利用可能領域を
TO領域とし、前記TO領域に隣接する同量ないしそれ
以下の既獲得済み領域をFROM領域とし、コピーによ
り個々のオブジェクト領域を移動させる形で部分ガベー
ジコレクション処理を行い、次に、前記TO領域のうち
オブジェクト領域が移動しないで利用可能として残った
領域と、空になったFROM領域を合わせた新しい残利
用可能領域を新たなTO領域とし、まだガベージコレク
ション処理を行ってない既獲得済み領域のうち新しい残
利用可能領域と同量の領域を新たなFROM領域として
再度部分ガベージコレクション処理を行い、既獲得済み
領域の全体にガベージコレクション処理が及ぶまで、以
降も同様に部分ガベージコレクション処理を繰り返すも
のである。
According to the dynamic memory management mechanism of the present invention, a heap area, memory acquisition means for acquiring a part of the heap area as an object area, and the acquired object area can be returned to the heap area for reuse. Garbage collection means for searching for an object area acquired by the memory acquisition means but no longer used by the program, and releasing the object area to the heap area using the memory release means,
The memory acquisition means sequentially acquires an object area from one end of the remaining available area in the heap area, and the garbage collection means first sets the remaining available area as a TO area, and sets the same amount adjacent to the TO area. Or, an already acquired area smaller than that is set as a FROM area, a partial garbage collection process is performed by moving individual object areas by copying, and then the object area of the TO area remains available without being moved. The new remaining available area, which is the combination of the area and the empty FROM area, is defined as a new TO area, and a new area of the same amount as the new remaining available area among the already acquired areas that have not yet been subjected to the garbage collection process is newly created. The partial garbage collection process is performed again as a simple FROM area, and garbage Until di collection process is over, it is intended to repeat the same in part garbage collection process or later.

【0086】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、部分ガベージコ
レクション処理を繰り返す際に、その途中で新しく生成
した残利用可能領域の大きさがある閾値を超えた場合
は、そこで繰り返しを止めるものである。
Further, in the dynamic memory management mechanism according to the present invention, when the garbage collection means repeats the partial garbage collection processing, the size of the newly generated remaining available area in the middle of the garbage collection processing exceeds a certain threshold. If so, stop the repetition.

【0087】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、部分ガベージコ
レクション処理を繰り返す前に、まずヒープ領域外の存
在するポインタから参照されるオブジェクト領域のベー
スポインタリストを作成し、続いて繰り返される部分ガ
ベージコレクション処理では、ヒープ領域外に存在する
ポインタの代わりに前記ベースポインタリストが保持す
るポインタを用いて処理を行い、前記ポインタが参照す
るオブジェクト領域がTO領域へコピーされた場合は、
前記ポインタを前記ベースポインタリストから削除する
ものである。
Further, in the dynamic memory management mechanism according to the present invention, before the garbage collection means repeats the partial garbage collection processing, first, the garbage collection means firstly generates a base pointer list of an object area referenced from a pointer existing outside the heap area. In the partial garbage collection process that is created and subsequently repeated, the process is performed using the pointer held by the base pointer list instead of the pointer existing outside the heap area, and the object area referenced by the pointer is copied to the TO area. If so,
The pointer is deleted from the base pointer list.

【0088】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、ガベージコレク
ション処理の繰り返しに際し、TO領域となる残利用可
能領域がヒープ領域内を常に一方向へ移動するよう、残
利用可能領域からのオブジェクト領域獲得順序およびヒ
ープ領域内におけるFROM領域とTO領域の相対位置
を固定させているものである。
Further, in the dynamic memory management mechanism according to the present invention, the garbage collection means may be configured such that, when the garbage collection process is repeated, the remaining available area as the TO area always moves in the heap area in one direction. The order in which the object areas are obtained from the remaining available area and the relative positions of the FROM area and the TO area in the heap area are fixed.

【0089】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、ガベージコレク
ション処理の繰り返しに際し、TO領域となる残利用可
能領域がヒープ領域内を往復するよう、残利用可能領域
からのオブジェクト領域獲得順序およびヒープ領域内に
おけるFROM領域とTO領域の相対位置を変化させる
ものである。
Further, in the dynamic memory management mechanism according to the present invention, the garbage collection means may be configured such that, when the garbage collection process is repeated, the remaining available area as the TO area reciprocates in the heap area. And the relative position of the FROM area and the TO area in the heap area.

【0090】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、TO領域となる
残利用可能領域が小さい時は、既獲得済み領域からTO
領域に隣接して設定するFORM領域をTO領域の量よ
り大きく設定し、まずFROM領域内の有効なオブジェ
クト領域の探索をオブジェクト領域の移動を伴わずに行
い、ついでFORM領域内の有効なオブジェクト領域を
FROM領域とTO領域を合わせた領域の一端につめる
ことで、残利用可能領域を大きくしてから、前記部分ガ
ベージコレクション処理を実行するものである。
Further, in the dynamic memory management mechanism according to the present invention, when the garbage collection means has a small remaining available area, which is a TO area, the garbage collection means deletes the TO area from the already acquired area.
The FORM area to be set adjacent to the area is set to be larger than the amount of the TO area. First, a search for an effective object area in the FROM area is performed without moving the object area. Is stored at one end of the combined area of the FROM area and the TO area to increase the remaining available area, and then execute the partial garbage collection process.

【0091】この発明に係る動的メモリ管理機構は、ヒ
ープ領域と、前記ヒープ領域からその一部をオブジェク
ト領域として獲得するメモリ獲得手段と、前記獲得した
オブジェクト領域を前記ヒープ領域に戻し再利用可能と
するメモリ開放手段と、前記メモリ獲得手段により獲得
されたがプログラムから利用されなくなったオブジェク
ト領域を探索し、前記メモリ開放手段を用いて前記ヒー
プ領域へ開放するガベージコレクション手段とを備え、
前記各オブジェクト領域を参照するポインタは、直接に
は参照テーブルのエントリを指し、前記ポインタによる
オブジェクト領域の参照は、必ず前記参照テーブルのエ
ントリを経由して行うものである。
According to the dynamic memory management mechanism of the present invention, there is provided a heap area, memory acquisition means for acquiring a part of the heap area from the heap area as an object area, and the acquired object area can be returned to the heap area for reuse. Memory releasing means, and garbage collection means for searching for an object area acquired by the memory acquiring means but no longer used by the program, and releasing the object area to the heap area using the memory releasing means,
The pointer that refers to each of the object areas directly points to an entry of the reference table, and the reference of the object area by the pointer is always performed via the entry of the reference table.

【0092】この発明に係る動的メモリ管理機構は、ヒ
ープ領域と、前記ヒープ領域からその一部をオブジェク
ト領域として獲得するメモリ獲得手段と、前記獲得した
オブジェクト領域を前記ヒープ領域に戻し再利用可能と
するメモリ開放手段と、前記メモリ獲得手段により獲得
されたがプログラムから利用されなくなったオブジェク
ト領域を探索し、前記メモリ開放手段を用いて前記ヒー
プ領域へ開放するガベージコレクション手段とを備え、
前記ガベージコレクション手段は、周期的に一定時間以
下のみガベージコレクション処理を行うよう動作するも
のである。
According to the dynamic memory management mechanism of the present invention, there is provided a heap area, memory acquisition means for acquiring a part of the heap area from the heap area as an object area, and returning the acquired object area to the heap area for reuse. Garbage collection means for searching for an object area acquired by the memory acquisition means but no longer used by the program, and releasing the object area to the heap area using the memory release means,
The garbage collection means operates to periodically perform a garbage collection process only for a certain period of time or less.

【0093】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、周期的に一定の
比率で真/偽が変化するフラグを参照し、前記フラグが
真の間だけ、ガベージコレクション処理を行うよう動作
するものである。
Also, in the dynamic memory management mechanism according to the present invention, the garbage collection means refers to a flag whose true / false changes periodically at a constant ratio, and only when the flag is true, the garbage collection means It operates to perform processing.

【0094】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、ガベージコレク
ション処理の実施可否を示すカウンタと、周期的に前記
カウンタを適切な値で増加させるカウンタ増加手段とを
有し、ガベージコレクション処理の進行状況に応じて前
記カウンタの値を減算しながら、前記カウンタの値が正
の間だけガベージコレクション処理を行うよう動作する
ものである。
Further, in the dynamic memory management mechanism according to the present invention, the garbage collection means includes a counter indicating whether or not garbage collection processing can be performed and a counter increasing means for periodically increasing the counter by an appropriate value. And operates so as to perform the garbage collection process only while the value of the counter is positive while subtracting the value of the counter according to the progress of the garbage collection process.

【0095】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、前記ヒープ領域
内の残利用可能領域の量がある閾値を超えるまでは、前
記カウンタの値が負にあってもガベージコレクション処
理を継続するものである。
Further, in the dynamic memory management mechanism according to the present invention, the garbage collection means may set the counter value to be negative until the amount of the remaining available area in the heap area exceeds a certain threshold. Also continues the garbage collection process.

【0096】この発明に係る動的メモリ管理機構は、ヒ
ープ領域と、前記ヒープ領域からその一部をオブジェク
ト領域として獲得するメモリ獲得手段と、前記獲得した
オブジェクト領域を前記ヒープ領域に戻し再利用可能と
するメモリ開放手段と、前記メモリ獲得手段により獲得
されたがプログラムから利用されなくなったオブジェク
ト領域を探索し、前記メモリ開放手段を用いて前記ヒー
プ領域へ開放するガベージコレクション手段とを備え、
前記ガベージコレクション手段は、ガベージコレクショ
ン処理を行う契機となった理由、プログラムの動作状
況、動的メモリ管理機構の内部状況、あるいはシステム
の稼動状況などのシステム状態に応じて、適宜異なるガ
ベージコレクション方式を使い分けるものである。
According to the dynamic memory management mechanism of the present invention, there is provided a heap area, memory acquisition means for acquiring a part of the heap area as an object area, and the acquired object area can be returned to the heap area for reuse. Garbage collection means for searching for an object area acquired by the memory acquisition means but no longer used by the program, and releasing the object area to the heap area using the memory release means,
The garbage collection means uses a different garbage collection method as appropriate depending on the system state such as the reason for performing the garbage collection process, the operation state of the program, the internal state of the dynamic memory management mechanism, or the operation state of the system. It is something to use properly.

【0097】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、ヒープ領域内の
残利用可能領域の不足により応用プログラムの動作中に
前記メモリ獲得手段が応用プログラムから要求された量
のオブジェクト領域を獲得できないため臨時に行う場合
と、あらかじめ設定されていたタイミングにより行う場
合とで、異なるガベージコレクション方式を使い分ける
ものである。
Further, in the dynamic memory management mechanism according to the present invention, the garbage collection means requests the memory acquisition means from the application program during the operation of the application program due to a shortage of the remaining available area in the heap area. A different garbage collection method is used depending on whether a temporary operation is performed because the amount of object area cannot be acquired and a case where the processing is performed at a preset timing.

【0098】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、最も最近に実施
したガベージコレクション処理の後に前記メモリ獲得手
段により獲得され、いまだガベージコレクションの処理
の対象となったことのないオブジェクト領域の数に応じ
て、異なるガベージコレクション方式を使い分けるもの
である。
Further, in the dynamic memory management mechanism according to the present invention, the garbage collection means is acquired by the memory acquisition means after the most recently performed garbage collection processing, and is still subjected to garbage collection processing. Different garbage collection methods are used depending on the number of object areas that do not have any.

【0099】また、この発明に係る動的メモリ管理機構
は、前記ガベージコレクション手段が、計算機システム
がシステム立ち上げ段階として動作している場合と、シ
ステムの定常段階として動作している場合とで、異なる
ガベージコレクション方式を使い分けるものである。
Further, the dynamic memory management mechanism according to the present invention is characterized in that the garbage collection means operates when the computer system is operating as a system startup stage and when the computer system is operating as a system steady stage. Different garbage collection methods are used.

【0100】この発明に係る動的メモリ管理機構は、ヒ
ープ領域と、前記ヒープ領域からその一部をオブジェク
ト領域として獲得するメモリ獲得手段と、前記獲得した
オブジェクト領域を前記ヒープ領域に戻し再利用可能と
するメモリ開放手段と、前記メモリ獲得手段により獲得
されたがプログラムから利用されなくなったオブジェク
ト領域を探索し、前記メモリ開放手段を用いて前記ヒー
プ領域へ開放するガベージコレクション手段とを備え、
応用プログラムの動作によりガベージコレクション処理
が必要となると、即座にガベージコレクション処理を行
うのではなく、別途定められたタイミングで行われるガ
ベージコレクション処理が終了するまで、同応用プログ
ラムの動作を停止させるものである。
According to the dynamic memory management mechanism of the present invention, a heap area, memory acquisition means for acquiring a part of the heap area from the heap area as an object area, and the acquired object area can be returned to the heap area for reuse. Garbage collection means for searching for an object area acquired by the memory acquisition means but no longer used by the program, and releasing the memory area to the heap area using the memory release means,
When the garbage collection process is required by the operation of the application program, the garbage collection process is not performed immediately, but the operation of the application program is stopped until the garbage collection process that is performed at a separately determined timing ends. is there.

【0101】また、この発明に係る動的メモリ管理機構
は、応用プログラムからの明示的にガベージコレクショ
ン指示が行われた場合に、即座にガベージコレクション
処理を行うのではなく、別途定められたタイミングで行
われるガベージコレクション処理が終了するまで、同応
用プログラムの動作を停止させるものである。
Further, the dynamic memory management mechanism according to the present invention does not immediately perform garbage collection processing when an garbage collection instruction is explicitly issued from an application program, but at a separately determined timing. The operation of the application program is stopped until the garbage collection process is completed.

【0102】また、この発明に係る動的メモリ管理機構
は、応用プログラムが前記メモリ獲得手段を用いてオブ
ジェクト領域を獲得しようとしたときに、ヒープ領域内
の残利用可能領域から応用プログラムが必要するオブジ
ェクト領域を得られないため、ガベージコレクション処
理が必要となった場合に、即座にガベージコレクション
処理を行うのではなく、別途定められたタイミングで行
われるガベージコレクション処理が終了するまで、同応
用プログラムの動作を停止させるものである。
Further, in the dynamic memory management mechanism according to the present invention, when the application program tries to acquire the object area by using the memory acquisition means, the application program needs from the remaining available area in the heap area. When the garbage collection process becomes necessary because the object area cannot be obtained, the garbage collection process is not performed immediately. The operation is stopped.

【0103】また、この発明に係る動的メモリ管理機構
は、複数の応用プログラムがガベージコレクション処理
の終了を待っている場合に、ガベージコレクション処理
により増加するヒープ領域内の残利用可能領域が、各プ
ログラムのそれぞれの要求を満たすようになった場合、
各プログラムは処理の継続が可能となった時点で順次そ
の停止が解除されるものである。
Further, the dynamic memory management mechanism according to the present invention, when a plurality of application programs are waiting for the end of the garbage collection processing, the remaining available area in the heap area increased by the garbage collection processing is As we meet each of the program's requirements,
The stop of each program is sequentially released when the processing can be continued.

【0104】そして、この発明に係る情報記録媒体は、
請求項1から請求項21までのいずれかに記載の動的メ
モリ管理機構を実現する計算機システムのプログラムを
記録したものである。
Then, the information recording medium according to the present invention
A program for a computer system for realizing the dynamic memory management mechanism according to any one of claims 1 to 21 is recorded.

【0105】[0105]

【発明の実施の形態】実施の形態1.この発明の実施の
形態1に係る動的メモリ管理機構について図面を参照し
ながら説明する。図1は、この発明の実施の形態1に係
る動的メモリ管理機構の構成を示すブロック図である。
なお、各図中、同一符号は同一又は相当部分を示す。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Embodiment 1 A dynamic memory management mechanism according to Embodiment 1 of the present invention will be described with reference to the drawings. FIG. 1 is a block diagram showing a configuration of the dynamic memory management mechanism according to Embodiment 1 of the present invention.
In the drawings, the same reference numerals indicate the same or corresponding parts.

【0106】本実施の形態1における構成は、図36に
示した第1の従来例の構成と同一であり、動的メモリ管
理機構1は、計算機システムのメモリ領域の一部である
ヒープ領域2と、同ヒープ領域2からその一部をオブジ
ェクト領域10として獲得するメモリ獲得手段3と、獲
得した同オブジェクト領域10を同ヒープ領域2に戻し
再利用可能とするメモリ開放手段4と、同メモリ獲得手
段3により獲得されたがプログラムから利用されなくな
ったオブジェクト領域10を探索し、同メモリ開放手段
4を用いて同ヒープ領域2に開放するガベージコレクシ
ョン手段5から構成される。同ヒープ領域2は、本実施
の形態1ではそのアドレスが連続する単一のメモリ領域
であるとするが、これは複数のメモリ領域から構成する
ことも容易に可能である。
The structure of the first embodiment is the same as the structure of the first conventional example shown in FIG. 36, and the dynamic memory management mechanism 1 includes a heap area 2 which is a part of the memory area of the computer system. A memory acquisition unit 3 for acquiring a part of the same heap area 2 as an object area 10, a memory release unit 4 for returning the acquired same object area 10 to the same heap area 2 for re-use, and a memory acquisition The garbage collection means 5 searches for the object area 10 acquired by the means 3 but is no longer used by the program, and releases it to the heap area 2 using the memory release means 4. Although the heap area 2 is a single memory area whose addresses are continuous in the first embodiment, the heap area 2 can be easily composed of a plurality of memory areas.

【0107】同ヒープ領域2には、1ないし複数のオブ
ジェクト領域10が存在し得る。個々のオブジェクト領
域10は、メモリ獲得手段3によって生成され、メモリ
開放手段4によって消去される、ヒープ領域2内の小さ
なメモリ領域である。オブジェクト領域10の中にはプ
ログラムの動作に必要な各種の情報が適宜保持される。
オブジェクト領域10が保持する情報はプログラムの開
発言語やプログラム設計に大きく依存し、プログラムの
動作に必要なデータだけを含む場合もあれば、プログラ
ムの命令コードも含む場合もある。
In the heap area 2, one or a plurality of object areas 10 can exist. Each object area 10 is a small memory area in the heap area 2 that is generated by the memory acquisition unit 3 and deleted by the memory release unit 4. Various kinds of information necessary for the operation of the program are appropriately held in the object area 10.
The information held in the object area 10 largely depends on the development language and program design of the program, and may include only data necessary for the operation of the program, or may include instruction codes of the program.

【0108】各オブジェクト領域10は、それぞれ参照
カウンタ11を持つ。これは参照カウンタ方式のガベー
ジコレクション処理における特徴的な構造であり、参照
カウンタ11は整数値を保持する変数であり、その値
は、対応するオブジェクト領域10がいくつのポインタ
12から参照されているかを示す。
Each object area 10 has a reference counter 11. This is a characteristic structure in the garbage collection process of the reference counter method. The reference counter 11 is a variable that holds an integer value, and the value indicates the number of pointers 12 to which the corresponding object area 10 is referenced. Show.

【0109】ポインタ12は、ガベージコレクション処
理を行うときに考慮が必要なプログラムのデータであ
る。ポインタ12は、プログラムがオブジェクト領域1
0を参照するため必要な情報を保持する記憶領域であ
り、計算機のCPUレジスタや、プログラムが静的に配
置したメモリ領域やスタック内の変数(小さなメモリ領
域)、オブジェクト領域10内の変数として存在する。
The pointer 12 is program data that needs to be considered when performing garbage collection processing. The pointer 12 indicates that the program is in the object area 1
This is a storage area for holding information necessary to reference 0, and exists as a CPU register of a computer, a memory area or a stack in a memory (small memory area) where a program is statically arranged, and a variable in the object area 10. I do.

【0110】つぎに、前述した実施の形態1に係る動的
メモリ管理機構の動作について図面を参照しながら説明
する。本実施の形態1は、他の方式との併用を前提とし
た参照カウンタ方式のガベージコレクション処理に関す
る発明の実施例であり、ガベージコレクション手段5
は、本発明にかかる参照カウンタ方式と他の方式を併用
したガベージコレクション処理を行う。併用する他のガ
ベージコレクション処理の方式は、第1の従来例の第2
の動作(図43、図45)で示したオブジェクト領域の
循環する参照による回収漏れと、第3の従来例で示した
フラグメンテーション現象の、2つの問題を回避した方
式ならばいずれの方式でも良く、例えば第4の従来例と
して示したマーク−コンパクト方式や、第5の従来例と
して示したストップ−コピー方式、さらにそれらの改良
である他の従来方式、そして本発明の請求項3に示され
る方式などを採用することができ、そのいずれとの組み
合わせでも本発明の効果を奏する。
Next, the operation of the dynamic memory management mechanism according to the first embodiment will be described with reference to the drawings. The first embodiment is an embodiment of the invention relating to the garbage collection process of the reference counter system on the assumption that it is used in combination with another system.
Performs a garbage collection process using both the reference counter method according to the present invention and another method. Another garbage collection method used in combination is the second conventional garbage collection method.
43 (FIG. 43) and FIG. 45 (FIG. 43), any method may be used as long as it avoids the two problems of the omission of collection due to the cyclic reference of the object area and the fragmentation phenomenon shown in the third conventional example. For example, the mark-compact method shown as the fourth conventional example, the stop-copy method shown as the fifth conventional example, further another conventional method which is an improvement thereof, and the method shown in claim 3 of the present invention. And the like can be adopted, and the effects of the present invention can be achieved by combining any of them.

【0111】本実施の形態1におけるオブジェクト獲得
の動作は第1の従来例(図37)と同一であり、オブジ
ェクト領域10の獲得の動作では、まずヒープ領域2内
の未使用部分からプログラムにより明示的あるいは暗示
的に指定された適切な大きさのメモリ領域を獲得し(P
1101)、次に獲得した領域をオブジェクト領域10
とみなしてその参照カウンタ11の値を0に設定し(P
1102)、さらに必要に応じて獲得したオブジェクト
領域内のその他の場所(データ)の初期化を行い(P1
103)、その後オブジェクト領域10を参照するため
に必要なポインタ12の値を返す。ここで、手順P11
02で参照カウンタ11の値を0とするのは、新たに生
成したオブジェクト領域10が、まだどこのポインタ1
2からも参照されておらず、同オブジェクト領域を参照
するポインタ12の数が0であることによる。
The operation of acquiring an object in the first embodiment is the same as that of the first conventional example (FIG. 37). In the operation of acquiring the object area 10, first, an unused portion in the heap area 2 is explicitly specified by a program. Acquires an appropriate or implicitly specified memory area (P
1101), the next acquired area is the object area 10
And the value of the reference counter 11 is set to 0 (P
1102) Further, if necessary, other places (data) in the acquired object area are initialized (P1).
103) Then, the value of the pointer 12 necessary for referring to the object area 10 is returned. Here, the procedure P11
The reason why the value of the reference counter 11 is set to 0 at 02 is that the newly generated object area 10 has a pointer 1
2, because the number of pointers 12 referring to the object area is 0.

【0112】図2は、本実施の形態1におけるポインタ
12の値の変更の動作を示すフローチャートである。ポ
インタ12の値の変更の動作S120では、まずその値
を変更するポインタ12が保持する値の有効性を検査す
る(P1201)。もしポインタ12が値の変更に先立
ちオブジェクト領域10を参照していれば(P1201
のYes)、本変更により参照先のオブジェクト領域1
0を参照するポインタ12の数が減るので、同オブジェ
クト領域10の参照カウンタ11の値を1減算し(P1
202)。その結果参照カウンタ11の値が0であれば
(P1203のYes)、対象とするオブジェクト領域
10はどこのポインタ12からも参照されていないオブ
ジェクト領域10、すなわち「ごみ」となったので、メ
モリ開放手段4を用いそのオブジェクト領域10の開放
を行う(P1209)。その後、ポインタ12の値を新
しい値に設定し(P1210)、もしその値が有効でオ
ブジェクト領域10を参照していれば(P1211のY
es)、参照先のオブジェクト領域10を参照するポイ
ンタ12の数が増えるので、同オブジェクト領域10の
参照カウンタ11の値を1加算し(P1212)、処理
を終える。
FIG. 2 is a flowchart showing the operation of changing the value of pointer 12 in the first embodiment. In the operation S120 of changing the value of the pointer 12, first, the validity of the value held by the pointer 12 that changes the value is checked (P1201). If the pointer 12 refers to the object area 10 before the value is changed (P1201
Yes), the object area 1 of the reference destination by this change
Since the number of pointers 12 referring to 0 is reduced, the value of the reference counter 11 of the object area 10 is decremented by 1 (P1
202). As a result, if the value of the reference counter 11 is 0 (Yes in P1203), the target object area 10 becomes an object area 10 that is not referenced by any pointer 12, that is, "garbage". The object area 10 is released using the means 4 (P1209). Thereafter, the value of the pointer 12 is set to a new value (P1210). If the value is valid and refers to the object area 10 (Y in P1211)
es) Since the number of pointers 12 that refer to the reference destination object area 10 increases, the value of the reference counter 11 of the object area 10 is incremented by 1 (P1212), and the process ends.

【0113】なお、値を変更する前のポインタ12が参
照するオブジェクト領域10の参照カウンタ11を1減
算しても、参照カウンタ11の値は0にならなければ
(P1203のNo)、対象とするオブジェクト領域1
0は、まだ他のポインタ12から参照されており、使用
中のオブジェクト領域10であるので、オブジェクト領
域10の開放処理は行わず、速やかにポインタ12に新
しい値を設定する(P1210)。これは値を変更する
前のポインタ12の値が無効な値であった場合(P12
01のNo)も同様で、速やかにポインタ12に新しい
値を設定する(P1210)。また、ポインタ12に設
定する新しい値が無効な値であれば(P1211のN
o)、更新すべき参照カウンタ11が存在しないので手
順P1212は行わず、速やかに処理を終える。
If the value of the reference counter 11 does not become 0 even when the value of the reference counter 11 of the object area 10 referred to by the pointer 12 before the value is changed becomes 1 (No in P1203), the object is regarded as a target. Object area 1
Since 0 is still referred to by the other pointer 12 and is the object area 10 in use, a new value is immediately set to the pointer 12 without releasing the object area 10 (P1210). This occurs when the value of the pointer 12 before changing the value is an invalid value (P12
The same applies to No. 01), which promptly sets a new value to the pointer 12 (P1210). If the new value set in the pointer 12 is an invalid value (N in P1211)
o) Since the reference counter 11 to be updated does not exist, the procedure P1212 is not performed, and the process ends immediately.

【0114】本実施の形態1の具体的な動作の様子を図
3、及び図4を用いて説明する。
The specific operation of the first embodiment will be described with reference to FIGS. 3 and 4. FIG.

【0115】図3は、本実施の形態1の動作の実施前を
示す解説図である。図3は、第1の従来例の第1の動作
の実施前を示す解説図(図39)と同一であり、図3に
おいて、ポインタRpは計算機のCPUレジスタ、プロ
グラムが静的に配置したメモリ領域、あるいはスタック
内の変数として、ヒープ領域2の外部に存在するポイン
タ12であり、第1のオブジェクト領域Aを参照してい
る。オブジェクト領域Aはその内部にポインタAp1お
よびポインタAp2を保持し、ポインタAp1は第2の
オブジェクト領域Bを、またポインタAp2は第3のオ
ブジェクト領域Cを参照している。オブジェクト領域B
はその内部にポインタBp1およびポインタBp2を保
持し、ポインタBp1はポインタAp2同様オブジェク
ト領域Cを参照しているが、ポインタBp2はいずれの
オブジェクト領域も参照せず無効な値を保持している。
オブジェクト領域Cはその内部にポインタ12は保持し
ない。オブジェクト領域AはポインタRpからのみ参照
されているので、オブジェクト領域Aの参照カウンタA
c1の値は1である。同様に、オブジェクト領域Bはポ
インタAp1からのみ参照されているので、その参照カ
ウンタBc1の値は1であり、オブジェクト領域Cはポ
インタAp2とポインタBp1から参照されているの
で、その参照カウンタCc1の値は2である。
FIG. 3 is an explanatory diagram showing a state before the operation according to the first embodiment is performed. FIG. 3 is the same as the explanatory diagram (FIG. 39) showing the first conventional example before the first operation is performed. A pointer 12 existing outside the heap area 2 as an area or a variable in the stack, and refers to the first object area A. The object area A holds therein the pointers Ap1 and Ap2, the pointer Ap1 refers to the second object area B, and the pointer Ap2 refers to the third object area C. Object area B
Holds a pointer Bp1 and a pointer Bp2 therein, and the pointer Bp1 refers to the object area C like the pointer Ap2, but the pointer Bp2 does not refer to any object area and holds an invalid value.
The object area C does not hold the pointer 12 therein. Since the object area A is referenced only by the pointer Rp, the reference counter A of the object area A
The value of c1 is 1. Similarly, since the object area B is referenced only by the pointer Ap1, the value of the reference counter Bc1 is 1, and since the object area C is referenced by the pointer Ap2 and the pointer Bp1, the value of the reference counter Cc1 is Is 2.

【0116】図3に示される状況においてポインタRp
を無効な値に変更する動作S120は次の通りとなる。
変更前のポインタRpの値はオブジェクト領域Aを参照
する有効な値なので、P1201、P1202と進む。
P1202の結果、参照カウンタAc1の値は0となる
ので、P1203のYesへ進み、オブジェクト領域A
を開放(P1209)したのちポインタRpの値を無効
な値に設定し(P1210)、その後S120を終え
る。図4は、本段階の状況を示す解説図であり、図3に
対しオブジェクト領域Aが開放され(破線)、ポインタ
Rpが無効な値に設定される。なお、本手順S120で
は第1の従来例の手順P120と異なり、オブジェクト
領域B、オブジェクト領域Cは開放されないが、これら
は別途行われる他の方式のガベージコレクション処理に
より回収される。
In the situation shown in FIG.
The operation S120 for changing to an invalid value is as follows.
Since the value of the pointer Rp before the change is a valid value referring to the object area A, the process proceeds to P1201 and P1202.
As a result of P1202, the value of the reference counter Ac1 becomes 0, so the processing proceeds to Yes in P1203, and the object area A
Is released (P1209), the value of the pointer Rp is set to an invalid value (P1210), and then S120 is terminated. FIG. 4 is an explanatory view showing the situation at this stage. In FIG. 3, the object area A is opened (broken line) and the pointer Rp is set to an invalid value. In this procedure S120, unlike the procedure P120 of the first conventional example, the object area B and the object area C are not released, but they are collected by another garbage collection process which is separately performed.

【0117】第1の従来例の説明で述べたように、参照
カウンタ方式のガベージコレクション処理は、オブジェ
クト領域間の循環した参照により「ごみ」を回収し損ね
るという問題があり、本問題を避けるため他の方式との
併用が必要であることが指摘されている。本実施の形態
1では、循環した参照に対する問題を回避する他の方式
と併用されることを前提として、ポインタの値の変更の
動作を上記のように行うことで、第1の従来例と異なり
ポインタの値の変更の動作S120の要する時間が予測
可能であり、かつ同様の効果を奏する第2の従来例に対
しては、参照カウンタが0になったオブジェクト領域を
開放するための専用のガベージコレクション処理P13
1が不要で、ガベージコレクション手段5をより簡素に
することができる。
As described in the description of the first conventional example, the garbage collection processing of the reference counter method has a problem that it is difficult to collect "garbage" due to a cyclic reference between object areas. It has been pointed out that it needs to be used in combination with other methods. The first embodiment is different from the first conventional example in that the operation of changing the value of the pointer is performed as described above on the assumption that it is used in combination with another method for avoiding the problem of the cyclic reference. In the second conventional example in which the time required for the operation S120 of changing the value of the pointer is predictable and has the same effect, a dedicated garbage for releasing the object area in which the reference counter becomes 0 is provided. Collection processing P13
1 is unnecessary, and the garbage collection means 5 can be simplified.

【0118】実施の形態2.この発明の実施の形態2
は、実施の形態1におけるポインタの値の変更の動作を
変更したものである。その基本構成およびオブジェクト
領域獲得の動作は実施の形態1と同一であるので、説明
を省略する。
Embodiment 2 Embodiment 2 of the present invention
Is a modification of the operation of changing the value of the pointer in the first embodiment. The basic configuration and the operation of acquiring the object area are the same as those in the first embodiment, and thus the description is omitted.

【0119】図5は、実施の形態2におけるポインタ1
2の値の変更の動作を示すフローチャートである。実施
の形態2におけるポインタ12の値の変更の動作S13
0でも、まず実施の形態1の手順S120と同じく、ポ
インタ12が保持する値を検査し(P1201)、もし
ポインタ12が有効なオブジェクト領域10を参照して
いれば(P1201のYes)、参照するオブジェクト
領域10の参照カウンタ11の値を1減算する(P12
02)。しかし、その結果参照カウンタ11の値が0で
あったときは(P1203のYes)、即座にオブジェ
クト領域10の開放の処理を行うのではなく、対象とす
るオブジェクト領域10がその内部に1ないし複数のポ
インタ12を持っていれば(P1204のYes)、オ
ブジェクト領域10内に存在するすべてのポインタ12
についてそのそれぞれの値を無効な値に設定してから
(S1301、P1207、P1208)、メモリ開放
手段4を用い対象とするオブジェクト領域10を開放す
る(P1209)。その後は、また実施の形態1と同
様、ポインタ12の値を新しい値に設定し(P121
0)、もしその値が有効でオブジェクト領域10を参照
していれば(P1211のYes)、参照先のオブジェ
クト領域10を参照するポインタ12の数が増えるの
で、同オブジェクト領域10の参照カウンタ11の値を
1加算し(P1212)、処理を終える。なお、これは
値を変更する前のポインタ12の値が無効な値であった
場合(P1201のNo)や、値を変更する前のポイン
タ12が参照するオブジェクト領域10の参照カウンタ
11を1減算しても参照カウンタ11の値は0にならな
い場合(P1203のNo)、オブジェクト領域10の
開放処理は行わず、速やかにポインタ12に新しい値を
設定する(P1210)点、またポインタ12に設定す
る新しい値が無効な値であれば(P1211のNo)、
更新すべき参照カウンタ11が存在しないので手順P1
212は行わず、速やかに処理を終える点も実施の形態
1に同じである。
FIG. 5 shows a pointer 1 according to the second embodiment.
9 is a flowchart illustrating an operation of changing a value of 2. Operation S13 of Changing Value of Pointer 12 in Second Embodiment
Even if it is 0, the value held by the pointer 12 is checked first (P1201) as in the procedure S120 of the first embodiment. If the pointer 12 refers to a valid object area 10 (Yes in P1201), the value is referred to. The value of the reference counter 11 of the object area 10 is decremented by 1 (P12
02). However, as a result, when the value of the reference counter 11 is 0 (Yes in P1203), the object area 10 is not immediately released, but one or more object areas 10 are contained therein. (Yes in P1204), all the pointers 12 existing in the object area 10 are stored.
Are set to invalid values (S1301, P1207, P1208), and then the target object area 10 is released using the memory release means 4 (P1209). After that, as in the first embodiment, the value of the pointer 12 is set to a new value (P121
0), if the value is valid and refers to the object area 10 (Yes in P1211), the number of pointers 12 referring to the referenced object area 10 increases, so that the reference counter 11 of the object area 10 The value is incremented by 1 (P1212), and the process ends. This is because the value of the pointer 12 before changing the value is an invalid value (No in P1201), or the reference counter 11 of the object area 10 referenced by the pointer 12 before changing the value is decremented by one. If the value of the reference counter 11 does not become 0 (No in P1203), the process of releasing the object area 10 is not performed, and a new value is immediately set to the pointer 12 (P1210), and the pointer 12 is set. If the new value is an invalid value (No in P1211),
Since there is no reference counter 11 to be updated, the procedure P1 is performed.
This is the same as the first embodiment in that the step 212 is not performed, and the process is immediately completed.

【0120】本実施の形態2の具体的な動作の様子を図
3、及び図5を用いて説明する。
The specific operation of the second embodiment will be described with reference to FIG. 3 and FIG.

【0121】本実施の形態2の動作の実施前を示す解説
図は、実施の形態1における動作の実施前を示す解説図
(図3)と同一であり説明を省略する。図3において、
ポインタRpを無効な値に変更する動作S130は次の
通りとなる。変更前のポインタRpの値はオブジェクト
領域Aを参照する有効な値なので、P1201、P12
02と進む。P1202の結果、参照カウンタAc1の
値は0となるので、P1203のYesへ進み、さらに
オブジェクト領域Aは内部にポインタAp1およびAp
2を含むので、P1204のYesからP1205へと
処理を進め、まずポインタAp1についてその値を無効
な値に設定する(S1301)。その後処理はP120
7のNo、P1208と進み、続くS1301では今度
はポインタAp2の値を無効な値に設定する。こうして
オブジェクト領域A内のすべてのポインタを無効に設定
し終えると(P1207のYes)、オブジェクト領域
Aを開放(P1209)したのちポインタRpの値を無
効な値に設定し(P1210)、その後P130を終え
る。図6は、本段階の状況を示す解説図であり、図3に
対しポインタAp1およびAp2が無効な値に設定さ
れ、オブジェクト領域Aが開放され(破線)、ポインタ
Rpが無効な値に設定される。本状況は、実施の形態1
の動作後の状況(図4)に対し、ポインタAp1および
Ap2の値が無効になっている点が異なる。
The explanatory diagram before the operation of the second embodiment is performed is the same as the explanatory diagram (FIG. 3) before the operation of the first embodiment, and the description is omitted. In FIG.
The operation S130 of changing the pointer Rp to an invalid value is as follows. Since the value of the pointer Rp before the change is a valid value referring to the object area A, P1201, P12
Proceed to 02. As a result of P1202, the value of the reference counter Ac1 becomes 0, so the process proceeds to Yes of P1203, and the object area A further includes pointers Ap1 and Ap therein.
Since P2 is included, the process proceeds from Yes in P1204 to P1205, and first sets the value of the pointer Ap1 to an invalid value (S1301). After that, the process is P120
In step S1301, the value of the pointer Ap2 is set to an invalid value. When all the pointers in the object area A have been set to be invalid (Yes in P1207), the object area A is released (P1209), and then the value of the pointer Rp is set to an invalid value (P1210). Finish. FIG. 6 is an explanatory diagram showing the situation at this stage. In FIG. 3, the pointers Ap1 and Ap2 are set to invalid values, the object area A is released (broken line), and the pointer Rp is set to invalid values. You. This situation is described in Embodiment 1.
4 in that the values of the pointers Ap1 and Ap2 are invalid.

【0122】本実施の形態2は上記のように動作するこ
とで、実施の形態1に比較し、ポインタ12の値の変更
動作S130の要する時間は長くなるものの、実施の形
態1と比較してポインタ12の値の変更に要する時間を
短縮することができ、また実施の形態1同様、第2の従
来例に比べガベージコレクション手段5が簡素にでき、
さらに実施の形態1と異なり開放するオブジェクト領域
10内に含まれるポインタ12を無効な値に設定するこ
とで、併用する他の方式のガベージコレクション処理に
おけるごみ識別が行い易くなり、その処理の効率を高く
することができる。
The second embodiment operates as described above, so that the time required for the operation of changing the value of the pointer 12 S130 is longer than that of the first embodiment, but is longer than that of the first embodiment. The time required for changing the value of the pointer 12 can be reduced, and the garbage collection means 5 can be simplified as compared with the second conventional example, as in the first embodiment.
Further, unlike Embodiment 1, by setting the pointer 12 included in the object area 10 to be released to an invalid value, garbage identification in the garbage collection processing of another system used together becomes easy, and the efficiency of the processing is reduced. Can be higher.

【0123】なお、本実施の形態2では、開放するオブ
ジェクト領域10内のポインタ12すべてについて無効
な値としたが(手順P1205、S1301、P120
7のYes、P1208)、処理するポインタ12の数
に上限を設けることで、実施の形態1と同様、ポインタ
の値の変更の動作に要する時間を予測可能とすることが
できる。また、その上限の個数を、例えばシステムのC
PU負荷状況など、システムの動作の状況に応じて変化
させることで、ポインタ12の値の変更の動作に要する
処理の重さと、併用する他の方式のガベージコレクショ
ン処理の重さを、システムの動作の状況に応じて適切に
制御でき、システム全体の効率や応答性の向上を図るこ
とができる。
In the second embodiment, invalid values are set for all the pointers 12 in the object area 10 to be released (procedures P1205, S1301, and P120).
7, Yes, P1208), by setting an upper limit on the number of pointers 12 to be processed, it is possible to predict the time required for the operation of changing the pointer value, as in the first embodiment. In addition, the number of the upper limit is, for example, C
The weight of the processing required for the operation of changing the value of the pointer 12 and the weight of the garbage collection processing of another system to be used together are changed by changing the value of the pointer 12 according to the operation state of the system such as the PU load state. Control can be appropriately performed according to the situation, and the efficiency and responsiveness of the entire system can be improved.

【0124】さらに、本実施の形態2の手法あるいは上
記本実施の形態2を発展させた手法を、第1の従来例に
示した参照カウンタ方式に適用し、第1の従来例のポイ
ンタ12の値の変更動作P120において、ポインタ1
2の値の変更に付随して再帰的に開放されるオブジェク
ト領域10の数や無効に設定するポインタ12の数につ
いて上限を設けることで、実施の形態1同様、ポインタ
12の値の変更の動作に要する時間を予測可能とするこ
とができ、またその上限を変化させることで、上記と同
様ポインタ12の値の変更動作に要する処理の重さと、
併用する他の方式のガベージコレクション処理の重さを
制御し、システム全体の効率や応答性向上を図ることが
できる。
Further, the method of the second embodiment or a method developed from the second embodiment is applied to the reference counter system shown in the first conventional example, and the pointer 12 of the first conventional example is used. In the value change operation P120, the pointer 1
By setting an upper limit on the number of object areas 10 recursively released along with the change of the value of 2 and the number of pointers 12 set to be invalid, the operation of changing the value of the pointer 12 is performed as in the first embodiment. Can be predicted, and by changing the upper limit, the weight of the processing required for the operation of changing the value of the pointer 12 can be
It is possible to control the weight of the garbage collection process of another system used together, and to improve the efficiency and responsiveness of the entire system.

【0125】実施の形態3.この発明の実施の形態3に
係る動的メモリ管理機構について図面を参照しながら説
明する。図7は、この発明の実施の形態3に係る動的メ
モリ管理機構の構成を示すブロック図である。図7にお
いて、動的メモリ管理機構1、ヒープ領域2、ガベージ
コレクション手段5、オブジェクト領域10、ポインタ
12は図1と同じであるの説明を省略する。ヒープ領域
2は、さらに、未だ利用されていないメモリ領域から構
成される残利用可能領域13と、既にプログラムから利
用されているメモリ領域から構成される既獲得済み領域
14の2つの領域から構成される。オブジェクト領域1
0は、まずメモリ獲得手段3によりヒープ領域2の一部
である残利用可能領域13から獲得され、これにより獲
得されたオブジェクト領域10は既獲得済み領域14の
一部を構成するようになる。また、オブジェクト領域1
0は、ガベージコレクション手段5に組み込まれて動作
するメモリ開放手段4によって開放されると、再び残利
用可能領域13の一部を構成するようになり、その領域
は再利用可能となる。
Embodiment 3 A dynamic memory management mechanism according to Embodiment 3 of the present invention will be described with reference to the drawings. FIG. 7 is a block diagram showing a configuration of the dynamic memory management mechanism according to Embodiment 3 of the present invention. 7, the dynamic memory management mechanism 1, the heap area 2, the garbage collection means 5, the object area 10, and the pointer 12 are the same as those in FIG. The heap area 2 further includes two areas: a remaining available area 13 composed of a memory area not yet used and an already acquired area 14 composed of a memory area already used by the program. You. Object area 1
0 is first acquired from the remaining available area 13 which is a part of the heap area 2 by the memory acquiring means 3, and the acquired object area 10 constitutes a part of the already acquired area 14. Also, object area 1
When 0 is released by the memory releasing means 4 which is incorporated in the garbage collection means 5 and operates, the part becomes a part of the remaining available area 13 again, and that area becomes reusable.

【0126】次に、本実施の形態3の動作について説明
する。図8は、本実施の形態3におけるガベージコレク
ション処理(GC処理)の動作を示すフローチャートで
ある。まず、処理開始時点の残利用可能領域13を最初
のTO領域15と定め(S1401)、既獲得済み領域
14のうち、まだガベージコレクション処理の対象とな
っておらず、かつTO領域15と隣接するTO領域15
と同じ量、またはそれより小さい領域をFROM領域1
6と定める(S1402)。なお、FROM領域16を
定める際には、FROM領域16に含まれるすべてのオ
ブジェクト領域10をTO領域15に移してもTO領域
15があふれることが無いよう、FROM領域16の境
界にまたがるオブジェクト領域10があれば、同オブジ
ェクト領域10はFROM領域16から除外する。次
に、大きく以下の3つの段階を踏み、部分ガベージコレ
クション処理(部分GC処理)を行う。まず最初に、計
算機のCPUレジスタ、プログラムが静的に配置したメ
モリ領域、あるいはスタック内の変数としてヒープ領域
2の外部に存在するすべてのポインタ12について、そ
れらのポインタ12から直接参照されるFROM領域1
6内のオブジェクト領域10を探索し、各オブジェクト
領域10をコピーによりTO領域15に移動する(P1
61)。次に、既獲得済み領域14のうちFROM領域
16以外にあるすべてのオブジェクト領域10を探索
し、それらのオブジェクト領域10から直接参照される
FROM領域16内のオブジェクト領域10についても
TO領域15に移動する(S141)。最後に、TO領
域15に移動したオブジェクト領域10を探索し、該当
するオブジェクト領域10から参照されるオブジェクト
領域10についてもコピーによりFROM領域16から
TO領域15へ移動する(P162)。手順P161、
S141、P162により、ヒープ領域2外のポインタ
12からと既獲得済み領域14のうちFROM領域16
以外に存在するオブジェクト領域10から直接または間
接に参照できるすべてのオブジェクト領域10はTO領
域15に移動したので、本段階でFROM領域16に残
るオブジェクト領域10は「ごみ」とみなすことができ
る。部分ガベージコレクション処理(P161、S14
1、P162)が終了すると、TO領域15のうちオブ
ジェクト領域10がコピーされず残った領域と空になっ
たFROM領域16を合わせ、新しい残利用可能領域1
3と定義し直し(S1403)、その後既獲得済み領域
14の中で、部分ガベージコレクション処理の未実施部
分が残っていれば(S1404のYes)、さらに部分
ガベージコレクション処理を繰り返し、既獲得済み領域
14の全体に対しガベージコレクション処理がなされる
ようにする。
Next, the operation of the third embodiment will be described. FIG. 8 is a flowchart showing the operation of the garbage collection process (GC process) according to the third embodiment. First, the remaining available area 13 at the start of the processing is determined as the first TO area 15 (S1401), and the garbage collection processing has not yet been performed in the already acquired area 14 and is adjacent to the TO area 15. TO area 15
The area equal to or smaller than the FROM area 1
6 (S1402). When the FROM area 16 is determined, the object area 10 extending over the boundary of the FROM area 16 is set so that the TO area 15 does not overflow even if all the object areas 10 included in the FROM area 16 are moved to the TO area 15. If there is, the object area 10 is excluded from the FROM area 16. Next, a partial garbage collection process (partial GC process) is performed by roughly taking the following three stages. First, for the CPU register of the computer, a memory area where the program is statically arranged, or all the pointers 12 existing outside the heap area 2 as variables in the stack, a FROM area directly referred to by the pointers 12 1
6 is searched for, and each object area 10 is moved to the TO area 15 by copying (P1).
61). Next, all the object areas 10 other than the FROM area 16 in the already acquired area 14 are searched, and the object areas 10 in the FROM area 16 directly referred to from the object areas 10 are also moved to the TO area 15. (S141). Finally, the object area 10 moved to the TO area 15 is searched, and the object area 10 referred to by the corresponding object area 10 is also moved from the FROM area 16 to the TO area 15 by copying (P162). Procedure P161,
By S141 and P162, from the pointer 12 outside the heap area 2 and the FROM area 16 of the already acquired area 14
Since all the object areas 10 that can be referred to directly or indirectly from the existing object areas 10 have moved to the TO area 15, the object areas 10 remaining in the FROM area 16 at this stage can be regarded as "garbage". Partial garbage collection processing (P161, S14
1, P162) is completed, the remaining area of the TO area 15 where the object area 10 has not been copied and the empty FROM area 16 are combined, and a new remaining available area 1 is obtained.
3 (S1403), and if there is an unprocessed portion of the partial garbage collection process remaining in the already acquired region 14 (Yes in S1404), the partial garbage collection process is further repeated to obtain the already acquired region. 14 so that the garbage collection process is performed on the entirety of 14.

【0127】つぎに、手順P161、S141、P16
2の詳細を示す。手順P161では、まずヒープ領域2
外にある適切なポインタ12の1つを選択し(P141
1)、そのポインタ12が有効でFROM領域16内に
あるオブジェクト領域10を参照していれば(P161
1のYes)、ポインタ12が参照するオブジェクト領
域10をコピーによりTO領域15へ移動し(P161
2)、本手順をヒープ領域2の外にあるすべてのポイン
タ12について繰り返す(P1413のYes、P14
14)。
Next, procedures P161, S141, P16
2 is shown below. In the procedure P161, first, the heap area 2
Select one of the outside appropriate pointers 12 (P141
1) If the pointer 12 is valid and refers to the object area 10 in the FROM area 16 (P161
1 (Yes), the object area 10 referred to by the pointer 12 is moved to the TO area 15 by copying (P161).
2), this procedure is repeated for all pointers 12 outside the heap area 2 (Yes in P1413, P14
14).

【0128】手順S141では、既獲得済み領域14の
うちFROM領域16以外にオブジェクト領域10があ
れば(S1411のYes)、まず該当するオブジェク
ト領域10を1つ選択し(S1412)、選択したオブ
ジェクト領域10が内部にポインタ12を含めば(P1
313のYes)、まず選択したオブジェクト領域10
に含まれるポインタ12の1つを選び(P1314)、
その値が有効で参照先オブジェクト領域10がFROM
領域16内に存在していれば(P1611のYes)、
参照先のオブジェクト領域10をコピーによりTO領域
15へ移動し処理対象へ加え(P1612)、本手順を
選択したオブジェクト領域10の内部に含まれるすべて
のポインタ12に繰り返し行い(P1315のNo)、
さらに既獲得済み領域14のうちFROM領域16以外
にあるオブジェクト領域10のすべてについて上記手順
を繰り返す(S1413のNo)。
In step S141, if there is an object area 10 in the acquired area 14 other than the FROM area 16 (Yes in S1411), one corresponding object area 10 is selected first (S1412), and the selected object area 10 is selected. If 10 includes a pointer 12 inside (P1
313, Yes), first, the selected object area 10
Is selected (P1314),
If the value is valid and the referenced object area 10 is FROM
If it exists in the area 16 (Yes in P1611),
The object area 10 of the reference destination is moved to the TO area 15 by copying and added to the processing target (P1612), and this procedure is repeated for all the pointers 12 included in the selected object area 10 (No in P1315),
Further, the above procedure is repeated for all the object areas 10 other than the FROM area 16 in the already acquired area 14 (No in S1413).

【0129】手順P162では、TO領域15内に未処
理のオブジェクト領域10があれば(P1621のYe
s)、まず該当するオブジェクト領域10を1つ選択し
(P1622)、選択したオブジェクト領域10が内部
にポインタ12を含めば(P1313のYes)、まず
選択したオブジェクト領域10に含まれるポインタ12
の1つを選び(P1314)、その値が有効で参照先オ
ブジェクト領域10がFROM領域16内に存在してい
れば(P1611のYes)、参照先のオブジェクト領
域10をコピーによりTO領域15へ移動し処理対象へ
加え(P1612)、本手順を選択したオブジェクト領
域10の内部に含まれるすべてのポインタ12に繰り返
し行い(P1315のNo)、さらにTO領域15内の
オブジェクト領域10のすべてについて上記手順を繰り
返す(P1623のNo)。
In procedure P162, if there is an unprocessed object area 10 in the TO area 15 (Ye in P1621)
s) First, one corresponding object area 10 is selected (P1622). If the selected object area 10 includes the pointer 12 therein (Yes in P1313), first, the pointer 12 included in the selected object area 10 is selected.
Is selected (P1314), and if the value is valid and the reference object area 10 exists in the FROM area 16 (Yes in P1611), the reference object area 10 is moved to the TO area 15 by copying. This procedure is repeated for all the pointers 12 included in the selected object area 10 (No in P1315), and the above procedure is repeated for all the object areas 10 in the TO area 15. Repeat (No in P1623).

【0130】本実施の形態3の具体的な動作の様子を図
9を用いて説明する。
The specific operation of the third embodiment will be described with reference to FIG.

【0131】図9は、本実施の形態3の動作を示す解説
図である。図9に示される処理前の状況は、残利用可能
領域13を最初のTO領域15とし(S1401)、既
獲得済み領域14のうちTO領域15に隣接するTO領
域15と同じ量の領域を最初のFROM領域16と設定
した(S1402)段階を示している。本状況に対し1
回目の部分ガベージコレクション処理(P161、P1
41、P162)と手順S1403を行い、さらに手順
S1401、S1402を行い新しいTO領域15およ
びFROM領域16を設定した段階が、図9に示される
1回目部分GC処理後の状況である。本段階では、前段
階のFROM領域16に含まれていたオブジェクト領域
は、第5の従来例として示したストップ−コピー方式と
同様の処理によって、「ごみ」が取除かれ前段階のTO
領域15の図中右側の領域に集められ、前段階のTO領
域15で余った領域(図中左側の領域)と前段階のFR
OM領域16を合併し新たなTO領域15に設定され、
また未だガベージコレクション処理がなされていない既
獲得済み領域14のうち新たなTO領域15に隣接する
同量の領域が新たなFROM領域16に設定されてい
る。本状況に対し2回目の部分ガベージコレクション処
理(P161、P141、P162)と手順S140
3、さらに手順S1401、S1402を行い新しいT
O領域15およびFROM領域16を設定した段階が、
図9に示される2回目部分GC処理後の状況であり、さ
らに3回目の部分ガベージコレクション処理(P16
1、P141、P162)と手順S1403を行った段
階が、図9に示される3回目部分GC処理後の状況であ
る。図9の3回目部分GC処理後では、未だガベージコ
レクション処理がなされていない既獲得済み領域14が
なくなったので、部分ガベージコレクション処理を繰り
返す必要はなく、ガベージコレクション処理の全体が終
了する。
FIG. 9 is an explanatory diagram showing the operation of the third embodiment. In the situation before the processing shown in FIG. 9, the remaining available area 13 is set as the first TO area 15 (S1401), and the area having the same amount as the TO area 15 adjacent to the TO area 15 in the already acquired area 14 is first set. (S1402) when the FROM area 16 is set. 1 for this situation
The second partial garbage collection process (P161, P1
41, P162), the procedure S1403, the procedures S1401, S1402, and the setting of the new TO area 15 and the FROM area 16 are the states after the first partial GC processing shown in FIG. At this stage, in the object region included in the previous stage FROM area 16, "garbage" is removed by the same processing as the stop-copy method shown as the fifth conventional example, and the TO stage of the previous stage is removed.
The area gathered in the area 15 on the right side in the figure of the area 15 and the surplus area (the area on the left side in the figure) of the TO area 15 in the previous stage and the FR in the previous stage
The OM area 16 is merged and set as a new TO area 15,
In addition, an area of the same amount adjacent to the new TO area 15 in the already acquired area 14 that has not been subjected to the garbage collection process is set in the new FROM area 16. For this situation, the second partial garbage collection process (P161, P141, P162) and procedure S140
3. Further, steps S1401 and S1402 are performed and a new T
When the O region 15 and the FROM region 16 are set,
This is the situation after the second partial GC processing shown in FIG. 9, and the third partial garbage collection processing (P16
1, P141, P162) and the step S1403 are the states after the third partial GC processing shown in FIG. After the third partial GC process in FIG. 9, there is no more acquired area 14 that has not yet been subjected to the garbage collection process, so there is no need to repeat the partial garbage collection process, and the entire garbage collection process ends.

【0132】本実施の形態3は上記のように動作するこ
とで、第5の従来例に挙げたストップ−コピー方式と同
様に、循環する参照を持つオブジェクト領域でも正しく
回収できる、フラグメンテーション現象が発生しない、
「生きている」オブジェクト領域と「ごみ」の区別のた
めの処理が速いなどの利点を有し、かつストップ−コピ
ー方式とは異なり半分以上のヒープ領域2を利用するこ
とができ、メモリ利用効率を高めることができる。
By operating as described above, in the third embodiment, a fragmentation phenomenon occurs in which an object area having a circulating reference can be correctly collected similarly to the stop-copy method described in the fifth conventional example. do not do,
It has the advantage that the processing for distinguishing between "live" object areas and "garbage" is fast, and, unlike the stop-copy method, can use more than half of the heap area 2 and has a high memory utilization efficiency. Can be increased.

【0133】なお、本実施の形態3では部分ガベージコ
レクション処理に第5の従来例に挙げたストップ−コピ
ー方式と同様の手順(手順P161、S141、P16
2)を用いているため、例えば第7の従来例として示し
たような、ストップ−コピー方式をインクリメンタル方
式化する既存の技術を適用することで、本実施の形態3
を容易にインクリメンタル方式に拡張することができ、
計算機システムの定応答性を向上させることができる。
In the third embodiment, the same procedure (procedures P161, S141, P16) as the stop-copy method described in the fifth conventional example is used for the partial garbage collection processing.
Since 2) is used, the third embodiment is applied by applying an existing technology for converting the stop-copy method into an incremental method as shown in the seventh conventional example.
Can be easily extended to incremental systems,
The constant response of the computer system can be improved.

【0134】また、本実施の形態3は部分ガベージコレ
クション処理を繰り返す際に、その繰り返し間で処理の
独立性が高いので、手順S1404から手順S1401
に戻る部分で一旦ガベージコレクション処理を休止し応
用プログラムの動作を行うようにし、ガベージコレクシ
ョン処理による応用プログラムの動作の中断時間を短く
することが容易に可能である。このような変形により、
インクリメンタル方式化の技術を適用せずとも、少ない
オーバヘッドで応用プログラムの動作の応答性を向上さ
せることができる。この際、部分ガベージコレクション
処理の繰り返しにおいて、用いるTO領域15の大きさ
に上限を課すようにすることで、各部分ガベージコレク
ション処理の処理時間を短くかつ予測可能とすることが
でき、応用プログラムの動作の応答性をより向上させる
ことができる。
In the third embodiment, when the partial garbage collection process is repeated, the process is highly independent between the repetitions.
In the part returning to the step, the garbage collection process is temporarily stopped to execute the operation of the application program, and the interruption time of the operation of the application program due to the garbage collection process can be easily reduced. With such deformation,
The responsiveness of the operation of the application program can be improved with little overhead without applying the technique of the incremental system. At this time, in the repetition of the partial garbage collection process, by setting an upper limit on the size of the TO area 15 used, the processing time of each partial garbage collection process can be shortened and predictable, and the application program The responsiveness of the operation can be further improved.

【0135】また、本実施の形態3において、部分ガベ
ージコレクション処理を繰り返す際に、新しくできた残
利用可能領域13の大きさが、あらかじめ定められた閾
値を超えたところで処理を打ち切るようにすることで、
ガベージコレクション処理全体の処理時間の短縮を図る
ことができる。この場合もまた、部分ガベージコレクシ
ョン処理の繰り返しにおいてTO領域15の大きさに対
し、固定的あるいは適応的に上限を課すようにすること
で、不要に大きな残利用可能領域13を集めないように
することができ、処理時間の短縮を図ることができる。
なお、処理打ち切りの閾値は、例えばシステムのCPU
負荷状況など、システムの動作の状況に応じて変化する
値とすることもでき、これによりガベージコレクション
処理の重さや確保する残利用可能領域13を制御し、計
算機システム全体の効率向上を図ることができる。
In the third embodiment, when the partial garbage collection process is repeated, the process is terminated when the size of the newly formed available remaining area 13 exceeds a predetermined threshold. so,
The processing time of the entire garbage collection process can be reduced. In this case as well, an upper limit is fixedly or adaptively imposed on the size of the TO area 15 in the repetition of the partial garbage collection process, so that an unnecessary large remaining available area 13 is not collected. And the processing time can be shortened.
Note that the threshold value of the processing termination is, for example, the CPU of the system.
It can be a value that changes according to the system operation status, such as the load status, and thereby controls the weight of the garbage collection process and the remaining available area 13 to be secured, thereby improving the efficiency of the entire computer system. it can.

【0136】実施の形態4.この発明の実施の形態4
は、実施の形態3におけるガベージコレクション処理の
動作を一部変更したものである。その基本構成は実施の
形態3と同一であるので説明を省略する。
Embodiment 4 Embodiment 4 of the present invention
Is a partial modification of the operation of the garbage collection process in the third embodiment. The basic configuration is the same as that of the third embodiment, and the description is omitted.

【0137】図10は、実施の形態4におけるガベージ
コレクション処理の動作を示すフローチャートである。
本動作もまた、実施の形態3におけるガベージコレクシ
ョン処理S140と同様、部分ガベージコレクション処
理を繰り返すが、手順S140と異なり、部分ガベージ
コレクション処理に先立ち、ヒープ領域外にあるポイン
タ12の一覧であるベースポインタリストを作成する。
すなわち、まずヒープ領域2外にある適切なポインタ1
2の1つを選択し(P1411)、そのポインタ12が
オブジェクト領域10を参照する有効な値であれば(P
1201のYes)、そのポインタ12の値をベースポ
インタリストへ保存し(S1501)、本手順をヒープ
領域2の外にあるすべてのポインタ12について繰り返
す(P1413のYes、P1414)。
FIG. 10 is a flowchart showing the operation of the garbage collection process in the fourth embodiment.
This operation also repeats the partial garbage collection process similarly to the garbage collection process S140 in the third embodiment. However, unlike the procedure S140, the base pointer which is a list of the pointers 12 outside the heap area prior to the partial garbage collection process. Create a list.
That is, first, the appropriate pointer 1 outside the heap area 2
2 is selected (P1411), and if the pointer 12 is a valid value referring to the object area 10, (P1411)
1201), the value of the pointer 12 is stored in the base pointer list (S1501), and this procedure is repeated for all pointers 12 outside the heap area 2 (Yes in P1413, P1414).

【0138】続いて、まず処理開始時点の残利用可能領
域13を最初のTO領域15と定め(S1401)、既
獲得済み領域14のうちまだガベージコレクション処理
の対象となっておらず、かつTO領域15と隣接するT
O領域15と同じ量、またはそれより小さい領域をFR
OM領域16と定める(S1402)。なお、FROM
領域16を定める際には、実施の形態3のガベージコレ
クション処理同様、FROM領域16に含まれるすべて
のオブジェクト領域10をTO領域15に移してもTO
領域15があふれることが無いよう、FROM領域16
の境界にまたがるオブジェクト領域10があれば、同オ
ブジェクト領域10はFROM領域16から除外する。
次に、大きく以下の3つの段階を踏み、部分ガベージコ
レクション処理(部分GC処理)を行う。まず最初に、
ベースポインタリストを元に、ヒープ領域2の外部に存
在するポインタ12から直接参照されるFROM領域1
6内のオブジェクト領域10を探索し、各オブジェクト
領域10をコピーによりTO領域15に移動する(S1
51)。次に、既獲得済み領域14のうちFROM領域
16以外にあるすべてのオブジェクト領域10を探索
し、それらのオブジェクト領域10から直接参照される
FROM領域内のオブジェクト領域10についてもTO
領域15に移動する(S141)。最後に、TO領域1
5に移動したオブジェクト領域10を探索し、該当する
オブジェクト領域10から参照されるオブジェクト領域
10についてもコピーによりFROM領域16からTO
領域15へ移動する(P162)。手順P161、S1
41、P162により、ヒープ領域外のポインタ12か
らと既獲得済み領域14のうちFROM領域16以外に
存在するオブジェクト領域10から直接または間接に参
照できるすべてのオブジェクト領域10はTO領域15
に移動したので、本段階でFROM領域16に残るオブ
ジェクト領域10は「ごみ」とみなすことができる。部
分ガベージコレクション処理(S151、S141、P
162)が終了すると、TO領域15のうちオブジェク
ト領域10がコピーされず残った領域と空になったFR
OM領域16を合わせ、新しい残利用可能領域13と定
義し直し(S1403)、その後既獲得済み領域14の
中で、部分ガベージコレクション処理の未実施部分が残
っていれば(S1404のYes)、手順S1401に
戻ってさらに部分ガベージコレクション処理を繰り返
し、既獲得済み領域14の全体に対しガベージコレクシ
ョン処理がなされるようにする。
Subsequently, the remaining available area 13 at the start of the processing is determined as the first TO area 15 (S1401), and the garbage collection processing has not yet been performed in the already acquired area 14 and the TO area T adjacent to 15
The region equal to or smaller than the O region 15
The OM area 16 is determined (S1402). In addition, FROM
When the area 16 is determined, similarly to the garbage collection processing of the third embodiment, even if all the object areas 10 included in the FROM area 16 are moved to the TO area 15,
To prevent the area 15 from overflowing, the FROM area 16
If there is an object area 10 that straddles the boundary, the object area 10 is excluded from the FROM area 16.
Next, a partial garbage collection process (partial GC process) is performed by roughly taking the following three stages. First of all,
From area 1 directly referenced by pointer 12 existing outside heap area 2 based on the base pointer list
6 is searched, and each object area 10 is moved to the TO area 15 by copying (S1).
51). Next, all the object areas 10 other than the FROM area 16 in the already acquired area 14 are searched, and the object areas 10 in the FROM area directly referred to from the object areas 10 are also searched for by TO.
Move to the area 15 (S141). Finally, TO area 1
5 is searched, and the object area 10 referenced from the corresponding object area 10 is also copied from the FROM area 16 to the TO area.
Move to area 15 (P162). Procedure P161, S1
According to 41 and P162, all object areas 10 that can be referred to directly or indirectly from the pointer 12 outside the heap area and the object area 10 existing in the already acquired area 14 other than the FROM area 16 can be referred to as the TO area 15
The object area 10 remaining in the FROM area 16 at this stage can be regarded as “garbage”. Partial garbage collection processing (S151, S141, P
162) is completed, the object area 10 in the TO area 15 is left uncopied and the empty FR
The OM area 16 is combined and redefined as a new remaining available area 13 (S1403). After that, if an unexecuted part of the partial garbage collection process remains in the already acquired area 14, the procedure proceeds to S1404. Returning to S1401, the partial garbage collection process is further repeated so that the garbage collection process is performed on the entire already acquired area 14.

【0139】次に、手順S151の詳細を示す。なお、
手順S141及び手順P162の詳細は、実施の形態3
(図8)における詳細と同一であるため説明を省略す
る。
Next, the details of step S151 will be described. In addition,
The details of the procedure S141 and the procedure P162 are described in Embodiment 3.
Since the details are the same as those in FIG. 8, the description is omitted.

【0140】手順S151では、まずベースポインタリ
ストにポインタが保存されていれば(S1511のYe
s)、保存されているポインタのうち最初の要素を選択
し(S1512)、そのポインタ12が有効でFROM
領域16内にあるオブジェクト領域を参照していれば
(S1513のYes)、ポインタ12が参照するオブ
ジェクト領域10をコピーによりTO領域15へ移動し
(P1612)、該当ポインタ12に対応する要素をベ
ースポインタリストから削除する(S1514)。本手
順をベースポインタリストに保持されるすべてのポイン
タ12について繰り返す(S1515のYes、S15
16)。
In step S151, if a pointer is stored in the base pointer list (Yes in S1511)
s), the first element is selected from the stored pointers (S1512), and if the pointer 12 is valid and FROM
If the object area in the area 16 is referred to (Yes in S1513), the object area 10 referred to by the pointer 12 is moved to the TO area 15 by copying (P1612), and the element corresponding to the pointer 12 is set to the base pointer. It is deleted from the list (S1514). This procedure is repeated for all the pointers 12 held in the base pointer list (Yes in S1515, S15
16).

【0141】本実施の形態4は上記のように動作するこ
とで、実施の形態3と異なり、ヒープ領域2外にあるポ
インタ12の探索を部分ガベージコレクション処理毎に
行うのでなく、ガベージコレクション処理全体で1回の
み行い、かつポインタ12の参照先が一度ガベージコレ
クション処理の対象になればその後は検査対象になら
ず、ヒープ領域2外のポインタ12の探索処理が効率化
されており、ガベージコレクション処理全体の処理時間
を短縮できる。
The fourth embodiment operates as described above and differs from the third embodiment in that the search for the pointer 12 outside the heap area 2 is not performed for each partial garbage collection process, but the entire garbage collection process is performed. Is performed only once, and if the reference destination of the pointer 12 is once subjected to the garbage collection processing, it is not subsequently inspected, and the search processing of the pointer 12 outside the heap area 2 is made more efficient, and the garbage collection processing is performed. Overall processing time can be reduced.

【0142】なお、実施の形態3同様、本実施の形態4
もストップ−コピー方式をインクリメンタル方式化する
ための既存の技術を適用することで、容易にインクリメ
ンタル方式に拡張することができ、計算機システムの定
応答性を向上させることができる。また、部分ガベージ
コレクション処理を繰り返す際に新しくできた残利用可
能領域の大きさが、適切に定められた閾値を超えたとこ
ろで処理を打ち切るようにすることで、やはりガベージ
コレクション処理全体の短縮を図ることができる。
Note that, as in the third embodiment, the fourth embodiment
Also, by applying the existing technology for converting the stop-copy system to the incremental system, the system can be easily extended to the incremental system, and the constant response of the computer system can be improved. In addition, when the size of the remaining available area newly created when repeating the partial garbage collection process exceeds an appropriately determined threshold, the process is terminated, so that the overall garbage collection process is also shortened. be able to.

【0143】実施の形態5.この発明の実施の形態5
は、実施の形態3におけるガベージコレクション処理の
動作を詳細化したものである。その基本構成は実施の形
態3と同一であるので説明を省略する。また、ガベージ
コレクション処理の基本動作も実施の形態3と同一であ
るので説明を省略する。
Embodiment 5 FIG. Embodiment 5 of the present invention
Is a detail of the operation of the garbage collection process in the third embodiment. The basic configuration is the same as that of the third embodiment, and the description is omitted. Further, the basic operation of the garbage collection process is the same as that of the third embodiment, and the description is omitted.

【0144】本実施の形態5は、実施の形態3におい
て、メモリ獲得手段3が残利用可能領域13の常に同じ
一端から獲得するよう動作し、ガベージコレクション処
理内で繰り返す部分ガベージコレクション処理は、メモ
リ獲得手段3の上記動作に適合するよう、分割されたF
ROM領域16及びTO領域15を扱えるようにし、こ
れによりガベージコレクション処理の繰り返しにおい
て、残利用可能領域13がヒープ領域2内を常に一方向
へ移動するよう動作させたものである。
In the fifth embodiment, in the third embodiment, the memory acquisition means 3 operates so as to always acquire from the same one end of the remaining available area 13, and the partial garbage collection process repeated in the garbage collection process is performed by The divided F so as to conform to the above operation of the acquisition means 3
The ROM area 16 and the TO area 15 can be handled so that the remaining available area 13 always moves in one direction in the heap area 2 when the garbage collection process is repeated.

【0145】本実施の形態5の具体的な動作の様子を図
11を用いて説明する。図11は、本実施の形態5の動
作を示す解説図である。本実施の形態5では、メモリ獲
得手段3は常に残利用可能領域13の図中左側からオブ
ジェクト領域10を獲得する。図11に示される前回G
C処理前の状況は、メモリ獲得手段3は残利用可能領域
13に対し図中左側からにオブジェクト領域10を獲得
し、既獲得済み領域14が成長してきたことを示す。本
状況に対し本実施の形態5に示すガベージコレクション
処理を1回行った段階が図11に示される前回GC処理
後の状況である。図11に示される前回GC処理前の状
況は、実施の形態3の動作を示す図9に示される処理前
の状況に等しく、図11に示される前回GC処理後の状
況は、図9に示される第3回目部分GC処理後の状況に
等しい。本実施の形態5のガベージコレクション処理
は、図11に示される前回GC処理前の状況、すなわち
ヒープ領域2の図中右端に残利用可能領域13があると
きは、実施の形態3と同様に動作する。
The specific operation of the fifth embodiment will be described with reference to FIG. FIG. 11 is an explanatory diagram showing the operation of the fifth embodiment. In the fifth embodiment, the memory acquisition unit 3 always acquires the object area 10 from the left of the remaining available area 13 in the figure. The previous G shown in FIG.
The state before the C processing indicates that the memory acquisition unit 3 has acquired the object area 10 from the left side in the figure with respect to the remaining available area 13 and the already acquired area 14 has grown. The stage in which the garbage collection process described in the fifth embodiment is performed once in this situation is the situation after the previous GC processing shown in FIG. The situation before the previous GC processing shown in FIG. 11 is equal to the situation before the processing shown in FIG. 9 showing the operation of the third embodiment, and the situation after the previous GC processing shown in FIG. 11 is shown in FIG. This is equivalent to the situation after the third partial GC process. The garbage collection process of the fifth embodiment operates in the same manner as in the third embodiment when the situation before the previous GC process shown in FIG. I do.

【0146】図11に示す前回GC処理後の状況から、
応用プログラムの動作によりメモリ獲得手段3が呼び出
され、複数のオブジェクト領域が新たに獲得された段階
が、図11に示される今回GC処理前の状況である。図
11に示す前回GC後の状況では、残利用可能領域13
はヒープ領域2の図中左端にあったが、本実施の形態5
ではメモリ獲得手段3は常に残利用可能領域13の図中
左側からオブジェクト領域10を獲得するため、既獲得
済み領域14はヒープ領域2の図中左端にも成長し、図
11に示される今回GC処理前の状況では、残利用可能
領域13の図中左側および右側の両方に既獲得済み領域
14が存在するようになっている。
From the situation after the previous GC processing shown in FIG.
The stage at which the memory acquisition means 3 is called by the operation of the application program and a plurality of object areas are newly acquired is the situation before the current GC processing shown in FIG. In the situation after the previous GC shown in FIG.
Is located at the left end of the heap area 2 in the figure.
Since the memory acquisition means 3 always acquires the object area 10 from the left side of the remaining available area 13 in the figure, the already acquired area 14 also grows on the left end of the heap area 2 in the figure, and the current GC shown in FIG. In the state before the processing, the already acquired area 14 exists on both the left and right sides of the remaining available area 13 in the figure.

【0147】図11に示す今回GC処理前の状況から、
本実施の形態5におけるガベージコレクション処理での
部分ガベージコレクション処理の1回目が終わった段階
が、図11に示す1回目部分GC処理後の状況である。
本段階の部分ガベージコレクション処理に用いたFRO
M領域16は、TO領域15に対し図中左側の既獲得済
み領域14から、TO領域15に隣接するようにTO領
域15と同量を設定した。本段階では、領域の大きさの
関係からFROM領域16はヒープ領域2の図中左端に
達成していないため、図11に示す1回目部分GC処理
後の状況は、単にFROM領域16をTO領域15の図
中右端へ詰める形で動作した結果となっている。
From the situation before the current GC processing shown in FIG.
A stage after the first partial garbage collection process in the garbage collection process in the fifth embodiment is a state after the first partial GC process shown in FIG.
FRO used for partial garbage collection at this stage
The amount of the M region 16 is set to be the same as that of the TO region 15 so as to be adjacent to the TO region 15 from the already acquired region 14 on the left side of the drawing with respect to the TO region 15. At this stage, the FROM area 16 has not reached the left end of the heap area 2 in the figure due to the size of the area, so the situation after the first partial GC processing shown in FIG. This is the result of the operation performed in such a manner that the right end in FIG.

【0148】図11に示す1回目部分GC処理後の状況
から、本実施の形態5におけるガベージコレクション処
理での部分ガベージコレクション処理の2回目が終わっ
た段階が、図11に示す2回目部分GC処理後の状況で
ある。2回目の部分ガベージコレクション処理に用いた
FROM領域16は、前回と異なり、TO領域15の図
中左側にある残利用可能領域14だけではTO領域15
と同量の領域を確保できないため、TO領域15に対し
図中右側にある既獲得済み領域14からも、同領域の右
端から不足分を補うFROM領域16を設定し、両者を
連続した1つのFROM領域16とみなして部分ガベー
ジコレクション処理を行う。この結果、図11に示す2
回目部分GC処理後の状況では、新たに設定される残利
用可能領域13、すなわち3回目の部分ガベージコレク
ション処理でのTO領域15が、ヒープ領域2の図中左
端と右端に分割される。
From the situation after the first partial GC processing shown in FIG. 11, the stage where the second partial garbage collection processing in the garbage collection processing in the fifth embodiment is completed is the second partial GC processing shown in FIG. The latter situation. Unlike the previous area, the FROM area 16 used in the second partial garbage collection process is different from the TO area 15 only in the remaining available area 14 on the left side of the TO area 15 in the drawing.
Since the same amount of area cannot be secured, a FROM area 16 that compensates for the shortage from the right end of the TO area 15 is also set from the already acquired area 14 on the right side of the figure, and one continuous area is set. The partial garbage collection process is performed assuming the FROM area 16. As a result, 2 shown in FIG.
In the situation after the third partial GC processing, the newly set remaining available area 13, that is, the TO area 15 in the third partial garbage collection processing is divided into the left end and the right end of the heap area 2 in the figure.

【0149】図11に示す2回目部分GC処理後の状況
から、本実施の形態5におけるガベージコレクション処
理での部分ガベージコレクション処理の3回目が終わっ
た段階が、図11に示す3回目部分GC処理後の状況で
ある。本段階の部分ガベージコレクション処理に用いた
TO領域15はヒープ領域2の図中右端と左端の2つに
分かれて存在するので、両者を連続した1つのTO領域
とみなして部分ガベージコレクション処理を行う。本段
階ではFROM領域16となるGC未実施の既獲得済み
領域14があまり残っていないため、図11の3回目部
分GC処理の状況では、図中左側のTO領域15の一部
にFROM領域16を詰める形で動作した結果となって
いるが、FROM領域16の内部に存在する「生きてい
る」オブジェクト領域の量によっては、図中左側のTO
領域15だけでは収まらず右側のTO領域15にも詰め
るよう動作する。
From the situation after the second partial GC processing shown in FIG. 11, the stage where the third partial garbage collection processing in the garbage collection processing in the fifth embodiment is completed is the third partial GC processing shown in FIG. The latter situation. Since the TO area 15 used for the partial garbage collection processing at this stage exists in the heap area 2 at the right end and the left end in the drawing, the partial garbage collection processing is performed by regarding both as a continuous one TO area. . At this stage, since the already acquired area 14 which has not been subjected to the GC, which is the FROM area 16, does not remain much, in the situation of the third partial GC processing of FIG. , But depending on the amount of the “living” object area existing inside the FROM area 16, the TO
The operation is performed so as not to cover only the area 15 but also to the right TO area 15.

【0150】本実施の形態5は上記のように動作するこ
とで、常に既獲得済み領域14内に存在するオブジェク
ト領域10のうち、メモリ獲得手段3によって応用プロ
グラムが獲得してから時間の経過の少ない「若い」オブ
ジェクト領域10を優先してガベージコレクション処理
の対象とすることができ、ガベージコレクション処理の
効率が向上する。さらに、部分ガベージコレクション処
理を繰り返す際に、新しくできた残利用可能領域13の
大きさが適切に定められた閾値を超えたところで処理を
打ち切る動作と併用することで、その効果が向上する。
By operating as described above, the fifth embodiment operates as described above, whereby the time lapse has elapsed since the application program was acquired by the memory acquisition means 3 in the object area 10 always existing in the already acquired area 14. A smaller “young” object area 10 can be prioritized for garbage collection processing, and the efficiency of garbage collection processing is improved. Further, when the partial garbage collection process is repeated, the effect is improved by using this operation together with the operation of terminating the process when the size of the newly available remaining available area 13 exceeds an appropriately determined threshold.

【0151】なお、本実施の形態5では「若い」オブジ
ェクト領域10を優先してガベージコレクション処理の
対象としたが、図11の今回GC処理前の状況におい
て、1回目部分GC処理におけるFROM領域16をT
O領域15に隣接する右側の既獲得済み領域14から設
定し、以降の部分ガベージコレクション処理でも同様に
設定することで、本実施の形態5とは逆に「古い」オブ
ジェクト領域10を優先してガベージコレクション処理
の対象とすることも容易に可能であり、これによりオブ
ジェクト領域10の寿命に関する挙動が一般的な応用プ
ログラムとは異なるプログラムに対するガベージコレク
ション処理の効率を向上させることができる。
In the fifth embodiment, the “young” object area 10 is subjected to the garbage collection processing with priority, but in the situation before the current GC processing in FIG. 11, the FROM area 16 in the first partial GC processing is used. To T
By setting from the already acquired area 14 on the right side adjacent to the O area 15 and setting similarly in the subsequent partial garbage collection processing, the “old” object area 10 is given priority in contrast to the fifth embodiment. Garbage collection processing can also be easily performed, thereby improving the efficiency of garbage collection processing for a program whose behavior related to the life of the object area 10 is different from a general application program.

【0152】実施の形態6.この発明の実施の形態6
は、実施の形態3におけるガベージコレクション処理の
動作を詳細化したものである。その基本構成は実施の形
態3と同一であるので説明を省略する。また、ガベージ
コレクション処理の基本的動作も実施の形態3と同一で
あるので説明を省略する。
Embodiment 6 FIG. Embodiment 6 of the present invention
Is a detail of the operation of the garbage collection process in the third embodiment. The basic configuration is the same as that of the third embodiment, and the description is omitted. Further, the basic operation of the garbage collection process is the same as that of the third embodiment, and the description is omitted.

【0153】本実施の形態6は、実施の形態3におい
て、ガベージコレクション処理により残利用可能領域1
3がヒープ領域2の端に達する度に、メモリ獲得手段3
が残利用可能領域13の異なる端から獲得するよう動作
し、ガベージコレクション処理内で繰り返す部分ガベー
ジコレクション処理は、メモリ獲得手段3の上記動作に
適合するよう、FROM領域16からオブジェクト領域
10を、TO領域15内でメモリ獲得手段13が獲得す
る端とは逆の端へ詰めるように移動させ、これによりガ
ベージコレクション処理の繰り返しにおいて、残利用可
能領域13がヒープ領域2内を往復するよう動作させた
ものである。
The sixth embodiment is different from the third embodiment in that the remaining available area 1 is obtained by garbage collection processing.
Each time the memory 3 reaches the end of the heap area 2, the memory acquisition means 3
Operates to acquire from the different end of the remaining available area 13, and the partial garbage collection processing repeated in the garbage collection processing is performed by relocating the object area 10 from the FROM area 16 to the TO In the area 15, the memory is moved to the end opposite to the end obtained by the memory obtaining means 13, so that the remaining available area 13 is operated to reciprocate in the heap area 2 in the repetition of the garbage collection process. Things.

【0154】本実施の形態6の具体的な動作の様子を図
12を用いて説明する。図12は、本実施の形態6の動
作を示す解説図である。図12に示される前回GC処理
前の状況は、メモリ獲得手段3は残利用可能領域13に
対し図中左側からにオブジェクト領域10を獲得し、既
獲得済み領域14が成長してきたことを示す。本状況に
対し本実施の形態6に示すガベージコレクション処理を
1回行った段階が図12に示される前回GC処理後の状
況である。図12に示される前回GC処理前の状況は、
実施の形態3の動作を示す図9に示される処理前の状況
に等しく、図12に示される前回GC処理後の状況は、
図9に示される第3回目部分GC処理後の状況に等し
い。本実施の形態6のガベージコレクション処理は、図
12に示される前回GC処理前の状況、すなわちヒープ
領域2の図中右端に残利用可能領域13があるときは、
実施の形態3と同様に動作する。
The specific operation of the sixth embodiment will be described with reference to FIG. FIG. 12 is an explanatory diagram showing the operation of the sixth embodiment. The situation before the previous GC processing shown in FIG. 12 indicates that the memory acquisition means 3 has acquired the object area 10 from the left side in the figure with respect to the remaining available area 13 and the already acquired area 14 has grown. The stage in which the garbage collection process described in the sixth embodiment is performed once in this situation is the situation after the previous GC processing shown in FIG. The situation before the previous GC processing shown in FIG.
The situation after the previous GC processing shown in FIG. 12 is equal to the situation before the processing shown in FIG.
This is equivalent to the situation after the third partial GC process shown in FIG. The garbage collection process according to the sixth embodiment is performed in a state before the previous GC process shown in FIG.
The operation is the same as in the third embodiment.

【0155】図12に示す前回GC処理後の状況から、
応用プログラムの動作によりメモリ獲得手段3が呼び出
され、複数のオブジェクト領域10が新たに獲得された
段階が、図12に示される今回GC処理前の状況であ
る。本実施の形態6のメモリ獲得手段3は、残利用可能
領域13がヒープ領域2の図中右端にある時は残利用可
能領域13の図中左端からオブジェクト領域10を獲得
し、逆に残利用可能領域13がヒープ領域2の図中左端
にあるときは残利用可能領域13の図中右端からオブジ
ェクト領域10を獲得するよう動作するので、図11に
示される実施の形態5とは異なり、図12に示す前回G
C処理後の状況で、残利用可能領域13はヒープ領域2
の図中左端にあったのを保つよう、既獲得済み領域14
は残利用可能領域13の図中右端から成長し、図11に
示される今回GC処理前の状況では、残利用可能領域1
3はヒープ領域2の図中左端に接するよう存在し、既獲
得済み領域14はヒープ領域2の図中右端に接するよう
存在している。
From the situation after the previous GC processing shown in FIG.
The stage at which the memory acquisition means 3 is called by the operation of the application program and a plurality of object areas 10 are newly acquired is the situation before the current GC processing shown in FIG. When the remaining available area 13 is at the right end of the heap area 2 in the figure, the memory acquiring means 3 of the sixth embodiment acquires the object area 10 from the left end of the remaining available area 13 in the figure, and conversely, When the available area 13 is at the left end of the heap area 2 in the figure, the operation is performed so as to acquire the object area 10 from the right end of the remaining available area 13 in the figure. Therefore, unlike the fifth embodiment shown in FIG. Previous G shown in 12
In the situation after the C processing, the remaining available area 13 is the heap area 2
In order to keep it on the left end in the figure,
Grows from the right end of the remaining available area 13 in the figure, and in the situation before the current GC processing shown in FIG.
3 exists so as to be in contact with the left end of the heap area 2 in the figure, and the already acquired area 14 exists so as to be in contact with the right end of the heap area 2 in the figure.

【0156】図12に示す今回GC処理前の状況から、
本実施の形態6におけるガベージコレクション処理での
部分ガベージコレクション処理の1回目が終わった段階
が、図12に示す1回目部分GC処理後の状況である。
本段階の部分ガベージコレクション処理に用いたFRO
M領域16は、TO領域15に対し図中右側の既獲得済
み領域14から、TO領域15に隣接するようにTO領
域15と同量を設定、これにより図12に示す1回目部
分GC処理後の状況は、単にFROM領域16をTO領
域15の図中左端へ詰める形で動作した結果となってい
る。
From the situation before the current GC processing shown in FIG.
The stage after the first partial garbage collection process in the garbage collection process in the sixth embodiment is the situation after the first partial GC process shown in FIG.
FRO used for partial garbage collection at this stage
The M area 16 is set to the same amount as the TO area 15 from the already acquired area 14 on the right side of the TO area 15 to the TO area 15 with respect to the TO area 15, whereby the first area GC processing shown in FIG. Is the result of operating simply by filling the FROM area 16 to the left end of the TO area 15 in the figure.

【0157】図12に示す1回目部分GC処理後の状況
から、本実施の形態6におけるガベージコレクション処
理での部分ガベージコレクション処理の2回目が終わっ
た段階が、図12に示す2回目部分GC処理後の状況で
ある。2回目の部分ガベージコレクション処理に用いた
FROM領域16もまた、前回同様、TO領域15に対
し図中右側の既獲得済み領域14からTO領域15に隣
接するようにTO領域15と同量を設定、これにより図
12に示す2回目部分GC処理後の状況も、1回目部分
GC処理後の状況と同様、単にFROM領域16をTO
領域15の図中左端へ詰める形で動作した結果となって
いる。
From the situation after the first partial GC processing shown in FIG. 12, the stage where the second partial garbage collection processing in the garbage collection processing in the sixth embodiment is completed is the second partial GC processing shown in FIG. The latter situation. The FROM area 16 used for the second partial garbage collection process is also set to the same amount as the TO area 15 so that the TO area 15 is adjacent to the TO area 15 from the already acquired area 14 on the right side of the drawing as in the previous time. As a result, the situation after the second partial GC processing shown in FIG.
The result is that the operation is performed in such a manner that the area 15 is shifted to the left end in the drawing.

【0158】図12に示す2回目部分GC処理後の状況
から、本実施の形態6におけるガベージコレクション処
理での部分ガベージコレクション処理の3回目が終わっ
た段階が、図12に示す3回目部分GC処理後の状況で
ある。本段階の部分ガベージコレクション処理でもま
た、前回同様、TO領域15に対し図中右側の既獲得済
み領域14からTO領域15に隣接するようにFROM
領域16を設定、これにより図12に示す2回目部分G
C処理後の状況も、1回目部分GC処理後の状況と同
様、単位FROM領域16をTO領域15の図中左端へ
詰める形で動作した結果となっている。
From the situation after the second partial GC processing shown in FIG. 12, the stage where the third partial garbage collection processing in the garbage collection processing in the sixth embodiment is completed is the third partial GC processing shown in FIG. The latter situation. Also in the partial garbage collection process at this stage, the FROM area is set so that the TO area 15 is adjacent to the TO area 15 from the already acquired area 14 on the right side in FIG.
The area 16 is set, and thereby the second portion G shown in FIG.
Similar to the situation after the first partial GC processing, the situation after the C processing is a result of operating the unit FROM area 16 to the left end of the TO area 15 in the drawing.

【0159】本実施の形態6は上記のように動作するこ
とで、少なくとも既獲得済み領域14内に存在するオブ
ジェクト領域10のうち、前回ガベージコレクション処
理が行われてからメモリ獲得手段3によって応用プログ
ラムが獲得した「若い」オブジェクト領域10を優先し
てガベージコレクション処理の対象とすることで、ガベ
ージコレクション処理の効率を保ちながら、実施の形態
5よりガベージコレクション処理の動作を簡素にするこ
とができる。
By operating as described above, the sixth embodiment operates the application program by the memory acquisition means 3 at least after the last garbage collection process has been performed in the object area 10 existing in the already acquired area 14. By giving priority to the “young” object area 10 acquired by the garbage collection process, it is possible to simplify the operation of the garbage collection process compared to the fifth embodiment while maintaining the efficiency of the garbage collection process.

【0160】なお、本実施の形態6において、部分ガベ
ージコレクション処理を繰り返す際に、新しくできた残
利用可能領域13の大きさが適切に定められた閾値を超
えたところで処理を打ち切る場合や、部分ガベージコレ
クション処理の合間に応用プログラムを動作できるよう
にする場合では、残利用可能領域13がヒープ領域2の
右端から左端へ移動しているときはメモリ獲得手段3は
残利用可能領域13の左端からオブジェクト領域10を
獲得し、逆に残利用可能領域13がヒープ領域2の左端
から右端へ移動しているときはメモリ獲得手段3は残利
用可能領域13の右端からオブジェクト領域10を獲得
するようにすることで、本実施の形態6と同じ効果をえ
ることができる。
In the sixth embodiment, when the partial garbage collection process is repeated, the process may be terminated when the size of the newly created remaining available area 13 exceeds an appropriately determined threshold value, In the case where the application program can be operated during the garbage collection process, when the remaining available area 13 is moving from the right end to the left end of the heap area 2, the memory acquisition unit 3 starts from the left end of the remaining available area 13 When the object area 10 is acquired and the remaining available area 13 is moving from the left end to the right end of the heap area 2, the memory acquisition means 3 acquires the object area 10 from the right end of the remaining available area 13. By doing so, the same effect as in the sixth embodiment can be obtained.

【0161】実施の形態7.この発明の実施の形態7
は、実施の形態3におけるガベージコレクション処理の
動作を一部変更したものである。その基本構成は実施の
形態3と同一であるので説明を省略する。
Embodiment 7 FIG. Embodiment 7 of the present invention
Is a partial modification of the operation of the garbage collection process in the third embodiment. The basic configuration is the same as that of the third embodiment, and the description is omitted.

【0162】図13は、実施の形態7におけるガベージ
コレクション処理の動作を示す全体のフローチャートで
ある。本動作もまた、実施の形態3におけるガベージコ
レクション処理S140と同様、部分ガベージコレクシ
ョン処理を繰り返すが、手順S140と異なり、部分ガ
ベージコレクション処理に先立ち、まず現在の残利用可
能領域13の大きさが部分ガベージコレクション処理を
行うのに十分であるか調べ(S1601)、もし十分で
なければ(S1601のNo)マーク−コンパクト方式
に類似したコンパクト式の部分ガベージコレクション処
理(部分コンパクト処理)を行い残利用可能領域13の
大きさを拡充し(S161)、その後、部分ガベージコ
レクション処理を行うため、手順S140と同様に、ま
ず処理開始時点の残利用可能領域13を最初のTO領域
15と定め(S1401)、既獲得済み領域14のう
ち、まだガベージコレクション処理の対象となっておら
ず、かつTO領域15と隣接するTO領域15と同じ
量、またはそれより小さい領域をFROM領域16と定
める(S1402)。なお、FROM領域16を定める
際には、第3の従来例のガベージコレクション処理同
様、FROM領域16に含まれるすべてのオブジェクト
領域をTO領域15に移してもTO領域があふれること
が無いよう、FROM領域16の境界にまたがるオブジ
ェクト領域10があれば、同オブジェクト領域10はF
ROM領域16から除外する。次に、大きく以下の3つ
の段階を踏み、部分ガベージコレクション処理(部分G
C処理)を行う。まず最初に、計算機のCPUレジス
タ、プログラムが静的に配置したメモリ領域、あるいは
スタック内の変数としてヒープ領域2の外部に存在する
すべてのポインタ12について、それらのポインタ12
から直接参照されるFROM領域16内のオブジェクト
領域10を探索し、各オブジェクト領域10をコピーに
よりTO領域15に移動する(P161)。次に、既獲
得済み領域14のうちFROM領域16以外にあるすべ
てのオブジェクト領域10を探索し、それらのオブジェ
クト領域10から直接参照されるFROM領域16内の
オブジェクト領域10についてもTO領域15に移動す
る(S141)。最後に、TO領域15に移動したオブ
ジェクト領域10を探索し、該当するオブジェクト領域
10から参照されるオブジェクト領域10についてもコ
ピーによりFROM領域16からTO領域15へ移動す
る(P162)。手順P161、S141、P162に
より、ヒープ領域外のポインタ12からと既獲得済み領
域14のうちFROM領域16以外に存在するオブジェ
クト領域10から直接または間接に参照できるすべての
オブジェクト領域10はTO領域15に移動したので、
本段階でFROM領域16に残るオブジェクト領域10
は「ごみ」とみなすことができる。部分ガベージコレク
ション処理( P161、S141、P162)が終了
すると、TO領域15のうちオブジェクト領域10がコ
ピーされず残った領域と空になったFROM領域16を
合わせ、新しい残利用可能領域13と定義し直し(S1
403)、その後既獲得済み領域14の中で、部分ガベ
ージコレクション処理の未実施部分が残っていれば(S
1404のYes)、手順S1401に戻ってさらに部
分ガベージコレクション処理を繰り返し、既獲得済み領
域14の全体に対しガベージコレクション処理がなされ
るようにする。なお、ガベージコレクション処理の開始
時に十分な残利用可能領域13が存在する場合は、手順
S151は行わず、直接手順S1401に進む。
FIG. 13 is an overall flowchart showing the operation of the garbage collection process in the seventh embodiment. This operation also repeats the partial garbage collection process similarly to the garbage collection process S140 in the third embodiment. However, unlike the procedure S140, prior to the partial garbage collection process, first the size of the current remaining available area 13 is partially It is checked whether the garbage collection process is sufficient (S1601). If it is not enough (No in S1601), a compact partial garbage collection process (partial compact process) similar to the mark-compact method is performed and the remaining use is possible In order to expand the size of the area 13 (S161) and then perform the partial garbage collection processing, first, as in step S140, the remaining available area 13 at the start of the processing is determined as the first TO area 15 (S1401). Garbage collection among the already acquired areas 14 Not subject to down process, and defining a FROM area 16 the same amount or smaller area, the TO region 15 adjacent to the TO area 15 (S1402). When the FROM area 16 is determined, similar to the garbage collection process of the third conventional example, the FROM area 16 is set so that the TO area does not overflow even if all the object areas included in the FROM area 16 are moved to the TO area 15. If there is an object area 10 extending over the boundary of the area 16, the object area 10
Exclude from ROM area 16. Next, the following three stages are roughly performed, and the partial garbage collection processing (partial G
C process). First, for the CPU register of the computer, the memory area where the program is statically arranged, or all the pointers 12 existing outside the heap area 2 as variables in the stack, those pointers 12
The object area 10 in the FROM area 16 that is directly referred to from is searched, and each object area 10 is moved to the TO area 15 by copying (P161). Next, all the object areas 10 other than the FROM area 16 in the already acquired area 14 are searched, and the object areas 10 in the FROM area 16 directly referred to from the object areas 10 are also moved to the TO area 15. (S141). Finally, the object area 10 moved to the TO area 15 is searched, and the object area 10 referred to by the corresponding object area 10 is also moved from the FROM area 16 to the TO area 15 by copying (P162). By the procedures P161, S141, and P162, all object areas 10 that can be directly or indirectly referenced from the pointer 12 outside the heap area and from the object area 10 other than the FROM area 16 in the already acquired area 14 are stored in the TO area 15. Because it moved
Object area 10 remaining in FROM area 16 at this stage
Can be regarded as “garbage”. When the partial garbage collection process (P161, S141, P162) ends, the remaining area of the TO area 15 where the object area 10 is not copied and the empty FROM area 16 are combined to define a new remaining available area 13. Fix (S1
403) Then, if there is an unexecuted portion of the partial garbage collection process in the already acquired area 14 (S403).
(Yes in 1404), the process returns to step S1401, and the partial garbage collection process is further repeated so that the garbage collection process is performed on the entire already acquired area 14. If there is sufficient remaining available area 13 at the start of the garbage collection process, the process directly proceeds to step S1401 without performing step S151.

【0163】手順P161、手順S141、手順P16
2の詳細は、実施の形態3(図8)における詳細と同一
であるため説明を省略する。
Procedure P161, Procedure S141, Procedure P16
The details of 2 are the same as the details in the third embodiment (FIG. 8), and thus the description is omitted.

【0164】次に、手順S161に示した、コンパクト
方式による部分ガベージコレクション処理(部分コンパ
クト処理)の詳細を示す。図14は、本実施の形態7お
けるガベージコレクション処理の動作を示す部分コンパ
クト処理のフローチャートである。本動作では、まず処
理開始時点の残利用可能領域13を最初のTO領域15
と定め(S1401)、既獲得済み領域14のうちTO
領域15と隣接する適切な大きさをFROM領域16と
定める(S1611)。なお、部分コンパクト処理S1
61実施後に得られる残利用可能済み領域13の大きさ
は、手順S1401で定めたTO領域15の大きさと手
順S1611で定めたFROM領域16の大きさの和か
ら、同FROM領域16に含まれる「生きている」オブ
ジェクト領域10の総量を減じたものとなる。このため
手順S1611で定めるFROM領域16の大きさは、
図13の手順S1601における現在の残利用可能領域
13の大きさが部分ガベージコレクション処理を行うの
に十分であるかの判断と関連付けて、部分コンパクト処
理S161終了後に、部分ガベージコレクション処理を
行うに適切な値が得られることが期待できる、適切な大
きさとする。
Next, details of the partial garbage collection processing (partial compact processing) by the compact method shown in step S161 will be described. FIG. 14 is a flowchart of a partial compact process showing the operation of the garbage collection process in the seventh embodiment. In this operation, first, the remaining available area 13 at the start of the processing is set to the first TO area 15.
(S1401), the TO of the already acquired area 14
An appropriate size adjacent to the area 15 is determined as the FROM area 16 (S1611). The partial compact processing S1
The size of the remaining available area 13 obtained after the execution of 61 is included in the FROM area 16 from the sum of the size of the TO area 15 determined in step S1401 and the size of the FROM area 16 determined in step S1611. The total amount of the "living" object area 10 is reduced. Therefore, the size of the FROM area 16 determined in step S1611 is
In association with the determination of whether the size of the current remaining available area 13 in step S1601 in FIG. 13 is sufficient to perform the partial garbage collection process, it is appropriate to perform the partial garbage collection process after the completion of the partial compact process S161. It should be an appropriate size that can be expected to obtain a good value.

【0165】次に、大きく以下の3つの段階を踏み、F
ROM領域16内の「生きている」オブジェクト領域1
0を抽出する。まず最初に、計算機のCPUレジスタ、
プログラムが静的に配置したメモリ領域、あるいはスタ
ック内の変数としてヒープ領域2の外部に存在するすべ
てのポインタ12について、それらのポインタ12から
直接参照されるFROM領域16内のオブジェクト領域
10を探索し、未検出のオブジェクト領域10があれ
ば、同オブジェクト領域10を有効オブジェクト領域リ
ストへ追加する(S162)。次に、既獲得済み領域1
4のうちFROM領域16以外にあるすべてのオブジェ
クト領域10を探索し、それらのオブジェクト領域10
から直接参照されるFROM領域内のオブジェクト領域
10についても、未検出のオブジェクト領域10であれ
ば、同オブジェクト領域10を有効オブジェクト領域リ
ストへ追加する(S163)。最後に、有効オブジェク
ト領域リストを探索し、有効オブジェクト領域リストに
あるオブジェクト領域10から参照されるFROM領域
16内のオブジェクト領域10についても、未検出であ
れば有効オブジェクト領域リストへ追加する(S16
4)。手順S162、S163、S164により、ヒー
プ領域外のポインタ12からと既獲得済み領域14のう
ちFROM領域16以外に存在するオブジェクト領域1
0から直接または間接に参照できるすべてのオブジェク
ト領域10は有効オブジェクト領域リストに登録された
ので、本段階でFROM領域16に存在し、かつ有効オ
ブジェクト領域リストに登録されていないオブジェクト
領域10は「ごみ」とみなすことができる。FROM領
域16内の「生きている」オブジェクト領域10の抽出
(S162、S163、S164)が終了すると、有効
オブジェクト領域リストに登録されているすべてのオブ
ジェクト領域10を、TO領域15とFROM領域16
を合わせた領域へ、TO領域16側から先に詰めるよ
う、コピーにより移動し(S1612)、その後、移動
により空となった領域を新しい残利用可能領域13と定
義し直す(S1613)。
Next, the following three steps are taken, and F
"Living" object area 1 in ROM area 16
Extract 0. First, the computer's CPU register,
With respect to all the pointers 12 existing outside the heap area 2 as variables in the memory area or the stack statically allocated by the program, the object area 10 in the FROM area 16 directly referred to by the pointers 12 is searched. If there is an undetected object area 10, the object area 10 is added to the valid object area list (S162). Next, already acquired area 1
4, all object areas 10 other than the FROM area 16 are searched, and those object areas 10 are searched.
Also, if the object area 10 in the FROM area directly referred to from is not detected, the object area 10 is added to the effective object area list (S163). Finally, the effective object area list is searched, and the object area 10 in the FROM area 16 referenced from the object area 10 in the effective object area list is added to the effective object area list if not detected (S16).
4). In steps S162, S163, and S164, the object area 1 existing from the pointer 12 outside the heap area and from the already acquired area 14 other than the FROM area 16
Since all the object areas 10 that can be referred to directly or indirectly from 0 are registered in the valid object area list, the object areas 10 that are present in the FROM area 16 at this stage and are not registered in the valid object area list are “garbage”. ] Can be considered. When the extraction of the “living” object area 10 in the FROM area 16 (S162, S163, S164) is completed, all the object areas 10 registered in the valid object area list are replaced with the TO area 15 and the FROM area 16
Is moved by copying so that the TO area 16 is packed first from the TO area 16 side (S1612), and then the area vacated by the movement is redefined as a new remaining available area 13 (S1613).

【0166】次に、手順S162、手順S163、手順
S164の詳細を示す。
Next, details of steps S162, S163 and S164 will be described.

【0167】手順S162では、まずヒープ領域2外に
ある適切なポインタ12の1つを選択し(P141
1)、そのポインタ12が有効でFROM領域16内に
ある未検出のオブジェクト領域10を参照していれば
(S1621のYes)、ポインタ12が参照するオブ
ジェクト領域10を有効オブジェクト領域リストに追加
登録し(S1622)、本手順をヒープ領域2の外にあ
るすべてのポインタ12について繰り返す(P1413
のYes、P1414)。
In step S162, one of the appropriate pointers 12 outside the heap area 2 is selected (P141).
1) If the pointer 12 is valid and refers to the undetected object area 10 in the FROM area 16 (Yes in S1621), the object area 10 referred to by the pointer 12 is additionally registered in the valid object area list. (S1622), this procedure is repeated for all pointers 12 outside the heap area 2 (P1413)
Yes, P1414).

【0168】手順S163では、既獲得済み領域14の
うちFROM領域16以外にオブジェクト領域10があ
れば(S1411のYes)、まず該当するオブジェク
ト領域10を1つ選択し(S1412)、選択したオブ
ジェクト領域10が内部にポインタ12を含めば(P1
313のYes)、まず選択したオブジェクト領域10
に含まれるポインタ12の1つを選び(P1314)、
その値が有効でFROM領域16内にある未検出のオブ
ジェクト領域10を参照していれば(S1621のYe
s)、参照先のオブジェクト領域10を有効オブジェク
ト領域リストに追加登録し(S1622)、本手順を選
択したオブジェクト領域10の内部に含まれるすべての
ポインタ12に繰り返し行い(P1315のNo)、さ
らに既獲得済み領域14のうちFROM領域16以外に
あるオブジェクト領域10のすべてについて上記手順を
繰り返す(S1413のNo)。
In step S163, if there is an object area 10 other than the FROM area 16 in the already acquired area 14 (Yes in S1411), one corresponding object area 10 is selected first (S1412), and the selected object area 10 is selected. If 10 includes a pointer 12 inside (P1
313, Yes), first, the selected object area 10
Is selected (P1314),
If the value is valid and refers to the undetected object area 10 in the FROM area 16 (Yes in S1621)
s), the object area 10 of the reference destination is additionally registered in the effective object area list (S1622), and this procedure is repeated for all the pointers 12 included in the selected object area 10 (No in P1315). The above procedure is repeated for all the object areas 10 in the acquired area 14 other than the FROM area 16 (No in S1413).

【0169】手順S164では、有効オブジェクト領域
リストに未処理のオブジェクト領域10があれば(S1
641のYes)、有効オブジェクト領域リストからま
ず該当するオブジェクト領域10を1つ選択し(S16
42)、選択したオブジェクト領域10が内部にポイン
タ12を含めば(P1313のYes)、まず選択した
オブジェクト領域10に含まれるポインタ12の1つを
選び(P1314)、その値が有効でFROM領域16
内にある未検出のオブジェクト領域10を参照していれ
ば(S1621のYes)、参照先のオブジェクト領域
10を有効オブジェクト領域リストに追加登録し(S1
622)、本手順を選択したオブジェクト領域10の内
部に含まれるすべてのポインタ12に繰り返し行い(P
1315のNo)、さらに有効オブジェクト領域リスト
に登録されているオブジェクト領域10のすべてについ
て上記手順を繰り返す(S1643のNo)。
In step S164, if there is an unprocessed object area 10 in the valid object area list (S1
641), and first selects one corresponding object area 10 from the effective object area list (S16).
42), if the selected object area 10 includes the pointer 12 inside (Yes in P1313), first, one of the pointers 12 included in the selected object area 10 is selected (P1314), and the value is valid and the FROM area 16 is selected.
If an undetected object area 10 within the object is referred to (Yes in S1621), the object area 10 of the reference destination is additionally registered in the valid object area list (S1).
622), this procedure is repeated for all the pointers 12 included in the selected object area 10 (P
1315), and the above procedure is repeated for all the object areas 10 registered in the valid object area list (No in S1643).

【0170】本実施の形態7の具体的な動作の様子を図
15を用いて説明する。
The specific operation of the seventh embodiment will be described with reference to FIG.

【0171】図15は、本実施の形態7の動作を示す解
説図である。図15に示される処理前の状態は、残利用
可能領域13を部分コンパクト処理S161におけるT
O領域15とし(S1401)、既獲得済み領域14の
うちTO領域15に隣接する適切な量の領域を部分コン
パクト処理S161におけるFROM領域16と設定し
た(S1611)段階を示している。本状況に対しFR
OM領域16内の「生きている」オブジェクト領域10
の抽出(S162、S163、S164)した段階が、
図15に示される有効オブジェクト探索後の状況であ
る。さらに本状況に対し、有効オブジェクト領域リスト
に登録されているすべてのオブジェクト領域10を、T
O領域15とFROM領域16を合わせた領域へ、TO
領域15側から先に詰めるよう、コピーにより移動(S
1612)した段階が、図15に示される部分コンパク
ト処理後の状況である。
FIG. 15 is an explanatory diagram showing the operation of the seventh embodiment. In the state before the processing shown in FIG. 15, the remaining available area 13 is set to T in the partial compact processing S161.
An O area 15 (S1401) is shown, and an appropriate amount of an area adjacent to the TO area 15 in the already acquired area 14 is set as the FROM area 16 in the partial compact processing S161 (S1611). FR for this situation
"Living" object area 10 in OM area 16
Is extracted (S162, S163, S164),
FIG. 16 shows a state after searching for an effective object shown in FIG. 15. Further, in response to this situation, all the object areas 10 registered in the effective object area list are
To the area where the O area 15 and the FROM area 16 are combined, TO
Move by copy so that area 15 side is packed first (S
1612) is the situation after the partial compact processing shown in FIG.

【0172】本実施の形態7は上記のように、ガベージ
コレクション処理開始前の残利用可能領域13が小さい
場合に、部分コンパクト処理を行いあらかじめ残利用可
能領域13を大きくしてから実施の形態3として示した
ガベージコレクション処理を行うよう動作することで、
ガベージコレクション処理開始前の残利用可能領域13
の大きさが小さい場合に部分ガベージコレクション処理
の繰り返し回数が多くなってしまうという問題を回避す
ることができ、ガベージコレクション処理の効率を上げ
ることができる。
As described above, in the seventh embodiment, when the remaining available area 13 before the start of the garbage collection process is small, a partial compact process is performed to increase the remaining available area 13 in advance, and then the third embodiment is performed. By performing the garbage collection process shown as,
Remaining available area 13 before garbage collection processing starts
Is small, it is possible to avoid the problem that the number of repetitions of the partial garbage collection process increases, and it is possible to increase the efficiency of the garbage collection process.

【0173】なお、本実施の形態7では部分コンパクト
処理S162において、FROM領域16内の「生きて
いる」オブジェクト領域10を抽出するために有効オブ
ジェクト領域リストを用い、その後「生きている」オブ
ジェクト領域を1つにまとめる方式を用いたが、手順S
162に示した方式に代え、例えば第4の従来例に示し
たマーク−コンパクト方式、さらにはその改良方式を用
いてもよく、同様の効果を得ることができる。
In the seventh embodiment, in the partial compact processing S162, the valid object area list is used to extract the "living" object area 10 in the FROM area 16, and thereafter the "living" object area is used. Are combined into one, but the procedure S
Instead of the system shown in FIG. 162, for example, the mark-compact system shown in the fourth conventional example, or an improved system thereof may be used, and the same effect can be obtained.

【0174】また、本実施の形態7では部分コンパクト
処理S162を1回のみ行うようにしたが、適切な残利
用可能領域13の大きさが得られるまで繰り返し行うよ
うにしても、同様の効果を得ることができ、更にはガベ
ージコレクション処理全体を部分コンパクト処理S16
2のみの繰り返しで行うようにしてもよい。
In the seventh embodiment, the partial compact processing S162 is performed only once. However, the same effect can be obtained by repeating the processing until the appropriate remaining available area 13 is obtained. And the entire garbage collection process can be partially compacted in step S16.
It may be performed by repeating only 2.

【0175】さらに、本実施の形態7は、実施の形態3
同様、既存のインクリメンタル方式化技術を適用するこ
とで、容易にインクリメンタル方式に拡張することがで
き、計算機システムの定応答性を向上させることができ
る。
Further, the seventh embodiment is different from the third embodiment.
Similarly, by applying the existing incremental system technology, the system can be easily expanded to the incremental system, and the constant response of the computer system can be improved.

【0176】またさらに、本実施の形態7は、やはり実
施の形態3同様、部分コンパクト処理S162や部分ガ
ベージコレクション処理(図13のS1401〜S14
04)の処理の移行及び処理の繰り返し間で、処理に独
立性が高いので、これらの部分で一旦ガベージコレクシ
ョン処理を休止し応用プログラムの動作を行うように
し、ガベージコレクション処理による応用プログラムの
動作の中断時間を短くすることが容易に可能である。
Further, in the seventh embodiment, as in the third embodiment, the partial compact processing S162 and the partial garbage collection processing (S1401 to S14 in FIG. 13) are performed.
Since the processing is highly independent between the transition of the processing of step 04) and the repetition of the processing, the garbage collection processing is temporarily suspended in these parts to perform the operation of the application program, and the operation of the application program by the garbage collection processing is performed. It is easily possible to reduce the interruption time.

【0177】さらに、本実施の形態7は、やはり実施の
形態3同様、部分コンパクト処理S162や部分ガベー
ジコレクション処理(図13のS1401〜S140
4)の処理の移行および処理の繰り返し部分で、新しく
できた残利用可能領域13の大きさが適切な閾値を超え
たところで処理を打ち切るようにすることで、ガベージ
コレクション処理全体の短縮を図ることができる。
In the seventh embodiment, as in the third embodiment, the partial compact processing S162 and the partial garbage collection processing (S1401 to S140 in FIG. 13) are performed.
In the process transition and repetition of the process 4), the process is terminated when the size of the newly available remaining area 13 exceeds an appropriate threshold, thereby shortening the entire garbage collection process. Can be.

【0178】実施の形態8.図16は、この発明の実施
の形態8の基本構成を示す構成図である。図16におい
て、ヒープ領域2、オブジェクト領域10、ポインタ1
2は図7と同じであるので説明を省略する。また、動的
メモリ管理機構1、メモリ獲得手段3、メモリ開放手段
4、ガベージコレクション手段5は本実施の形態8の動
作の説明上重要でないためその記述を省略している。参
照テーブル17は、ヒープ領域2内の各オブジェクト領
域10への参照を保持するテーブルであり、ヒープ領域
2の外部に存在する。
Embodiment 8 FIG. FIG. 16 is a configuration diagram showing a basic configuration of the eighth embodiment of the present invention. In FIG. 16, heap area 2, object area 10, pointer 1
2 is the same as FIG. 7, and the description is omitted. Further, the dynamic memory management mechanism 1, the memory acquisition means 3, the memory release means 4, and the garbage collection means 5 are not important for the description of the operation of the eighth embodiment, and their descriptions are omitted. The reference table 17 is a table that holds a reference to each object area 10 in the heap area 2, and exists outside the heap area 2.

【0179】次に、本実施の形態8の動作を説明する。
本実施の形態8(図16)は、実施の形態3(図7)と
異なり、ポインタ12は直接オブジェクト領域10を参
照せず、必ず参照テーブル17のエントリを経由してオ
ブジェクト領域10への参照を行う。参照テーブル17
のエントリとオブジェクト領域10の対応づけは、オブ
ジェクト領域10を生成するメモリ獲得手段3により成
され、オブジェクト領域10が存在している間は、オブ
ジェクト領域10が「生きている」場合でも「ごみ」の
場合でもその対応づけは不変であり、オブジェクト領域
10を開放するメモリ開放手段4によりその対応付けが
失われる。また、ガベージコレクション手段5が行うガ
ベージコレクション処理に付随してオブジェクト領域1
0の配置が移動する場合は、参照テーブル17のエント
リの内容は対応するオブジェクト領域10を正しく参照
できるよう、その内容が更新される。一方、ポインタ1
2は、オブジェクト領域10への参照に必要な情報を、
参照テーブル17のエントリを特定する情報として保持
する。ポインタ12からオブジェクト領域10を参照す
る場合は、常にまずポインタ12の保持する情報を元に
参照テーブル17のエントリを特定し、該当するエント
リの保持する情報を元に対応するオブジェクト領域10
にたどり着く形で行われる。
Next, the operation of the eighth embodiment will be described.
In the eighth embodiment (FIG. 16), unlike the third embodiment (FIG. 7), the pointer 12 does not directly refer to the object area 10 but always refers to the object area 10 via the entry of the reference table 17. I do. Lookup table 17
Is associated with the object area 10 by the memory acquisition means 3 that generates the object area 10. As long as the object area 10 exists, even if the object area 10 is “live”, “garbage” In this case, the association is unchanged, and the association is lost by the memory releasing means 4 for releasing the object area 10. In addition, the object area 1 is added to the garbage collection
When the position of 0 moves, the contents of the entry of the reference table 17 are updated so that the corresponding object area 10 can be correctly referred to. On the other hand, pointer 1
2 is information necessary for reference to the object area 10,
The information is stored as information for specifying an entry in the reference table 17. When referring to the object area 10 from the pointer 12, the entry of the reference table 17 is always specified based on the information held by the pointer 12, and the corresponding object area 10 is specified based on the information held by the corresponding entry.
It is performed in a form to arrive at.

【0180】本実施の形態8では、参照テーブル17は
エントリの配列であり、ポインタ12は参照テーブル1
7でエントリを特定するための配列の添え字(整数値)
を保持し、参照テーブルのエントリは対応するオブジェ
クト領域10に関するメモリ領域上の先頭アドレスを保
持する。図16において、オブジェクト領域Aを参照す
るヒープ領域2外にあるポインタRp及びオブジェクト
領域B内のポインタBp1は、共に参照テーブル17内
でオブジェクト領域Aに対応づけられた同じエントリを
指すよう、同じ該当エントリの配列の添え字を保持す
る。同様に、オブジェクト領域Bを参照するオブジェク
ト領域A内のポインタAp2は、参照テーブル17内で
オブジェクト領域Bに対応づけられたエントリを指すよ
う、該当エントリの配列の添え字を保持する。無効な値
を保持しているオブジェクト領域B内のポインタBp2
は、参照テーブル17内で無効な値を示すための特別な
エントリを指すよう、該当エントリの配列の添え字を保
持する。ガベージコレクション処理によりメモリ領域上
でのオブジェクト領域10の配置位置が変化した場合
は、参照テーブル17の対応するエントリの保持するア
ドレス値のみが変更され、ポインタ12の値は変更され
ない。
In the eighth embodiment, the reference table 17 is an array of entries, and the pointer 12 is the reference table 1
Subscript (integer value) of array to specify entry in 7
, And the entry of the reference table holds the start address of the corresponding object area 10 in the memory area. In FIG. 16, a pointer Rp outside the heap area 2 referring to the object area A and a pointer Bp1 inside the object area B both have the same value so as to point to the same entry associated with the object area A in the reference table 17. Holds the subscript of the array of entries. Similarly, the pointer Ap2 in the object area A that refers to the object area B holds a suffix of the corresponding entry array so as to point to the entry associated with the object area B in the reference table 17. Pointer Bp2 in object area B holding an invalid value
Holds a subscript of the array of the entry so as to point to a special entry for indicating an invalid value in the lookup table 17. When the arrangement position of the object area 10 in the memory area is changed by the garbage collection process, only the address value held by the corresponding entry of the reference table 17 is changed, and the value of the pointer 12 is not changed.

【0181】本実施の形態8は上記のように動作するこ
とにより、第6の従来例と同様に、ガベージコレクショ
ン処理によってオブジェクト領域10が移動する際に、
同オブジェクト領域10を指すポインタ12の調整処理
を単純にすることができ、かつ第6の従来例とは異な
り、参照テーブル17がヒープ領域2から独立している
ので、第4の従来例に示したマーク−コンパクト方式
や、あるいは実施の形態7における部分コンパクト処理
(S161)のような、オブジェクト領域10の移動に
際し移動前の領域が破壊されるガベージコレクション方
式に組み合わせることが可能である。また、存在するオ
ブジェクト領域10はすべて参照テーブル17に登録さ
れているので、ガベージコレクション処理に際し参照テ
ーブル17を用いることでオブジェクト領域10の探索
が容易になり、さらにガベージコレクション処理時に比
較的大きさの小さい参照テーブル17を頻繁にアクセス
することで、計算機システム内の仮想アドレス変換キャ
ッシュやメモリキャッシュの動作効率が向上すること
で、ガベージコレクション処理の処理速度が高まるとい
う効果が得られる。
According to the eighth embodiment, the operation as described above allows the object area 10 to be moved by the garbage collection process as in the sixth conventional example.
Since the adjustment process of the pointer 12 pointing to the object area 10 can be simplified, and unlike the sixth conventional example, the reference table 17 is independent of the heap area 2, the fourth conventional example is shown. It can be combined with the mark-compact method or the garbage collection method in which the area before the movement is destroyed when the object area 10 is moved, such as the partial compact processing (S161) in the seventh embodiment. Further, since all the existing object areas 10 are registered in the reference table 17, the search of the object area 10 is facilitated by using the reference table 17 in the garbage collection processing. Frequent access to the small reference table 17 improves the operation efficiency of the virtual address translation cache and the memory cache in the computer system, thereby increasing the processing speed of the garbage collection process.

【0182】本実施の形態8における参照テーブル17
の大きさは、少なくともヒープ領域2内に同時に存在す
るすべてのオブジェクト領域10に対応したエントリを
保持できる大きさであればよく、ヒープ領域2内に同時
に存在できるオブジェクト領域10の最大数を考慮して
定めても、あるいはヒープ領域の大きさに合わせて定め
ても、さらにはヒープ領域2内に存在するオブジェクト
領域10の数に合わせて動的に変化させても良い。
Reference table 17 in the eighth embodiment
Should be large enough to hold at least the entries corresponding to all the object areas 10 that exist simultaneously in the heap area 2. Considering the maximum number of the object areas 10 that can exist simultaneously in the heap area 2, May be determined according to the size of the heap area, or may be dynamically changed according to the number of object areas 10 existing in the heap area 2.

【0183】また、本実施の形態8では、ポインタ12
は参照テーブル17のエントリを指すために、配列の添
え字(整数値)を保持するとしたが、これはエントリの
配置アドレスを保持するようにしても同様の効果が得ら
れる。さらに、本実施の形態8では、ポインタ12で無
効な値を示すために参照テーブル17に専用の特別なエ
ントリを持つようにしたが、これは参照テーブル17は
有効なオブジェクト領域10を参照するエントリしか保
持しないようにし、代わりにポインタ12が特別な値、
例えば配列の添え字であれば負値であったり、配置アド
レスであれば0ないしNULLといった参照テーブル1
7のエントリを指定するのには不適切な値を保持するよ
うにしても、同様の効果が得られる。
In the eighth embodiment, the pointer 12
Holds the subscript (integer value) of the array to indicate the entry of the reference table 17, but the same effect can be obtained by holding the arrangement address of the entry. Further, in the eighth embodiment, a special entry dedicated to the reference table 17 is provided in order to indicate an invalid value with the pointer 12, but this is because the reference table 17 has an entry that refers to the valid object area 10. And only the pointer 12 has a special value,
For example, a reference table 1 such as a negative value for a subscript of an array or 0 to NULL for an arrangement address
The same effect can be obtained by holding an inappropriate value for designating the 7th entry.

【0184】さらに、本実施の形態8では、参照テーブ
ル17はヒープ領域2の外部に存在するとしたが、参照
テーブル17はポインタ12の保持する値から一意にア
クセスできれば良いので、ヒープ領域2内にオブジェク
ト領域10とは別途確保したり、あるいは決して開放さ
れることのないオブジェクト領域10の1つとして確保
することでも、同様の効果を得ることができる。同じ理
由で、参照テーブル17を1つの連続した表として構成
する代わりに、複数の副表から構成してもよく、さらに
はポインタ12の保持する値からオブジェクト領域10
へ対応づける任意の構造、例えば木構造などを採用して
も、同様の効果を得られる。
Further, in the eighth embodiment, the reference table 17 is assumed to exist outside the heap area 2. The same effect can be obtained by separately securing the object area 10 or securing it as one of the object areas 10 that is never released. For the same reason, instead of constructing the reference table 17 as one continuous table, it may be composed of a plurality of sub-tables.
The same effect can be obtained even if an arbitrary structure corresponding to, for example, a tree structure is adopted.

【0185】実施の形態9.この発明の実施の形態9
は、応用プログラムとガベージコレクション処理の動作
タイミングに関するものである。その基本構成は実施の
形態3と同一であるので説明を省略する。
Embodiment 9 FIG. Embodiment 9 of the present invention
Relates to the operation timing of the application program and the garbage collection process. The basic configuration is the same as that of the third embodiment, and the description is omitted.

【0186】図17は、本実施の形態9の動作を示すフ
ローチャートである。本実施の形態9におけるガベージ
コレクション処理(GC処理)S200は、大きくは次
の3つの段階、事前処理S201、繰り返される単位処
理S202、事後処理S203から構成され、まずガベ
ージコレクション処理のうち繰り返し処理S202に入
る前の準備として事前処理S201を行った後、GC稼
動可否フラグを検査し(S2001)、その値が真すな
わちガベージコレクション処理を継続して良い状況であ
れば(S2001のYes)、ガベージコレクション処
理の繰り返し処理S202を1単位処理分だけ実行し、
その後さらに繰り返し処理を継続する必要があれば(S
2002のNo)、GC稼動可否フラグが真の間(S2
001のYes)繰り返し処理S202を繰り返し、繰
り返し処理S202を行う必要がなくなるか(S200
2のYes)、GC稼動可否フラグが偽となりガベージ
コレクション処理を継続できない状況であれば(S20
01のNo)、ガベージコレクション処理のうち繰り返
し処理S202の後始末として事後処理S203を行
い、処理を終了する。
FIG. 17 is a flowchart showing the operation of the ninth embodiment. The garbage collection process (GC process) S200 in the ninth embodiment is roughly composed of the following three stages, a pre-process S201, a repeated unit process S202, and a post-process S203. After performing pre-processing S201 as a preparation before entering, the GC operation availability flag is checked (S2001). If the value is true, that is, if garbage collection processing can be continued (Yes in S2001), garbage collection is performed. The repetition process S202 is executed for one unit process,
Thereafter, if it is necessary to continue the repetitive processing (S
(No in 2002), while the GC operation availability flag is true (S2
(Yes of 001) Whether the repetition process S202 is repeated and the repetition process S202 does not need to be performed (S200)
(Yes of 2), if the GC operation availability flag is false and the garbage collection process cannot be continued (S20)
(No of 01), post-processing S203 is performed as an end of the repetition processing S202 of the garbage collection processing, and the processing ends.

【0187】次に、手順S201、S202、S203
の詳細を示す。手順S201、S202、S203の具
体的処理内容は、元とするガベージコレクション処理に
よって異なるが、まず実施の形態3に示すガベージコレ
クション処理を元にした場合では、手順S201及び手
順S203の詳細は空の処理となり、手順S202の詳
細は、図8のS1401、S1402、S161、S1
41、S162、S1403、S1404の手続きとな
る。また、実施の形態4に示すガベージコレクション処
理を元にした場合では、手順S201の詳細は、図10
のS105、P141、P1201、P1501、P1
413、P1414の手続きとなり、手順S203の詳
細は、図10のS1401、S1402、S151、S
141、S162、S1403、S1404の手続きと
なり、手順S203の詳細は空の処理となる。なお、手
順S202に示す処理は、0回から最大で繰り返す必要
がなくなるまでの、任意回数の繰り返しが可能な処理で
なければならず、繰り返しを途中で止めた場合にメモリ
獲得手段3、メモリ開放手段4、ないしガベージコレク
ション手段5のいずれか、あるいは複数の手段で内部的
な不整合が発生することは許容されない。
Next, steps S201, S202, S203
The details are shown below. Although the specific processing contents of steps S201, S202, and S203 differ depending on the garbage collection processing, first, in the case where the garbage collection processing described in the third embodiment is used, the details of steps S201 and S203 are empty. The processing is performed, and details of the procedure S202 are described in S1401, S1402, S161, and S1 in FIG.
41, S162, S1403, and S1404. Further, in the case where the garbage collection processing described in the fourth embodiment is based, details of the procedure S201 are described in FIG.
S105, P141, P1201, P1501, P1
413 and P1414, and details of the procedure S203 are described in S1401, S1402, S151, S151 in FIG.
The procedures are 141, S162, S1403, and S1404, and the details of the procedure S203 are empty. The process shown in the step S202 must be a process that can be repeated an arbitrary number of times from zero to the maximum, and the memory acquisition unit 3 and the memory release The occurrence of internal inconsistency in any of the means 4 or the garbage collection means 5 or a plurality of means is not allowed.

【0188】次に、本実施の形態9の動作について図1
8を用いて説明する。図18は、本実施の形態9の動作
を示す解説図であり、応用プログラムは適切な周期T1
で周期的に動作し、GC稼動可否フラグは応用プログラ
ム開始と同期して真となり、その後T1より短い一定時
間T2の経過後に偽となるよう、周期的に変化するよう
制御する。また、ガベージコレクション処理S200
は、応用プログラムと同時に動作契機が与えられるが、
両者が同時に動作可能な場合は、応用プログラムのほう
がガベージコレクション処理より優先して動作するよ
う、制御する。
Next, the operation of the ninth embodiment will be described with reference to FIG.
8 will be described. FIG. 18 is an explanatory diagram showing the operation of the ninth embodiment, and the application program has an appropriate period T1.
, And the GC operation availability flag is controlled to periodically change to become true in synchronization with the start of the application program, and then to become false after a certain time T2 shorter than T1. The garbage collection process S200
Is given an opportunity to operate simultaneously with the application program,
If both can operate at the same time, control is performed so that the application program operates prior to the garbage collection process.

【0189】本実施の形態9では上記のように、ガベー
ジコレクション処理S200は、応用プログラムの動作
契機から時間T2の間で、かつ応用プログラムの動作が
中断しているか、または応用プログラムの動作が終了し
ているときしか動作できないように制御されるので、最
大でもT2/T1(<1)(正確には(T2+手順S2
02の実行時間)/T1)の比率までしかその処理を行
わないように制限できるので計算機システムの動作が安
定し、さらに次の応用プログラムの動作契機では必ずガ
ベージコレクションの処理が終了しているようにするの
で、応用プログラムの周期的動作を阻害せず、計算機シ
ステムの定応答性を向上できる。
In the ninth embodiment, as described above, the garbage collection process S200 is performed during the time T2 from the operation trigger of the application program and the operation of the application program is interrupted, or the operation of the application program is terminated. Is controlled so that it can be operated only when the operation is performed, T2 / T1 (<1) at the maximum (exactly (T2 + procedure S2)
Since the processing can be restricted so that the processing is performed only up to the ratio of (execution time 02) / T1), the operation of the computer system is stabilized, and the garbage collection processing is always completed at the next operation of the application program. Therefore, the constant response of the computer system can be improved without hindering the periodic operation of the application program.

【0190】なお、本実施の形態9において、手順S2
01、S202、S202のそれぞれの処理を実行中に
は、途中で応用プログラムの処理を優先させて応用プロ
グラムの処理を行うことができない場合でも、例えば実
施の形態3の説明で言及したように、それらの処理の間
ではガベージコレクション処理を休止させ応用プログラ
ムの動作ができるようにすれば、応用プログラム実行中
に一旦ガベージコレクション処理が動作しても、その中
断時間を短く抑えることができ、計算機システムの定応
答性が向上できる。
In the ninth embodiment, the procedure S2
01, S202, and S202, even if it is not possible to perform the processing of the application program by giving priority to the processing of the application program in the middle, for example, as described in the description of the third embodiment, By suspending the garbage collection process between these processes and allowing the application program to operate, even if the garbage collection process operates once during the execution of the application program, the interruption time can be reduced, and the computer system Can be improved.

【0191】また、本実施の形態9ではガベージコレク
ション処理S200の動作契機を応用プログラムの動作
契機と同時に与えられるとしたが、これは周期T1で動
作するすべての応用プログラムの動作が終了してからガ
ベージコレクション処理S200への動作契機が与えら
れるようにしてもよく、この場合は、応用プログラムの
処理をより優先して行うことができ、応用プログラムの
動作の応答性をより向上させることができる。
In the ninth embodiment, the operation of the garbage collection process S200 is provided at the same time as the operation of the application program. However, this operation is performed after the operation of all the application programs operating in the cycle T1 is completed. An operation trigger to the garbage collection process S200 may be given. In this case, the processing of the application program can be performed with higher priority, and the responsiveness of the operation of the application program can be further improved.

【0192】実施の形態10.この発明の実施の形態1
0は、応用プログラムとガベージコレクション処理の動
作タイミングに関するものである。その基本構成は実施
の形態3と同一であるので説明を省略する。
Embodiment 10 FIG. Embodiment 1 of the present invention
0 relates to the operation timing of the application program and the garbage collection process. The basic configuration is the same as that of the third embodiment, and the description is omitted.

【0193】図19は、本実施の形態10の動作を示す
フローチャートである。本実施の形態10におけるガベ
ージコレクション処理(GC処理)S210は、実施の
形態9同様、大きくは次の3つの段階、事前処理S20
1、繰り返される単位処理S202、事後処理S203
から構成され、まずガベージコレクション処理のうち繰
り返し処理S202に入る前の準備として事前処理S2
01を行った後、GC稼動可否カウンタを検査し(S2
101)、その値が0より大きくガベージコレクション
処理を継続して良い状況であれば(S2101のYe
s)、ガベージコレクション処理の繰り返し処理S20
2を1単位処理分だけ実行し、その後GC稼動可否カウ
ンタの値を1減じ(S2102)、さらに繰り返し処理
を継続する必要があれば(S2002のNo)、GC稼
動可否カウンタの値が0より大きい間(S2001のY
es)繰り返し処理S202を繰り返し、繰り返し処理
S202を行う必要がなくなるか(S2002のYe
s)、GC稼動可否カウンタの値が0以下となりガベー
ジコレクション処理を継続できない状況であれば(S2
001のNo)、ガベージコレクション処理のうち繰り
返し処理S202の後始末として事後処理S203を行
い、処理を終了する。
FIG. 19 is a flowchart showing the operation of the tenth embodiment. The garbage collection process (GC process) S210 in the tenth embodiment is roughly the same as the ninth embodiment in the following three stages, a pre-process S20.
1. Repeated unit processing S202, post processing S203
First, as a preparation before entering the repetition processing S202 of the garbage collection processing, a pre-processing S2
01, the GC operation availability counter is checked (S2
101), if the value is larger than 0 and the garbage collection process can be continued (Ye in S2101)
s), garbage collection processing repetition processing S20
2, the value of the GC operation availability counter is decremented by 1 (S2102), and if it is necessary to continue the repetition processing (No in S2002), the value of the GC operation availability counter is greater than 0. Interval (Y in S2001)
es) Is it unnecessary to repeat the repetition process S202 and perform the repetition process S202 (Yes in S2002)
s) If the value of the GC operation availability counter is 0 or less and the garbage collection process cannot be continued (S2)
(No in 001), the post-processing S203 is performed as an end of the repetition processing S202 in the garbage collection processing, and the processing ends.

【0194】手順S201、S202、S203の詳細
は、実施の形態9と同じであるので、説明を省略する。
The details of steps S201, S202, and S203 are the same as those in the ninth embodiment, and thus description thereof is omitted.

【0195】次に、本実施の形態10の動作について図
20を用いて説明する。図20は、本実施の形態10の
動作を示す解説図であり、応用プログラムは適切な周期
T1で周期的に動作し、GC稼動可否カウンタは応用プ
ログラム開始と同期して適切な一定値が加算される。な
お、GC稼動可否カウンタに加算する値は、応用プログ
ラムの処理が長引いた後に、ガベージコレクション処理
S210が行われても、応用プログラムの次の動作契機
までにはガベージコレクション処理S210が終わるよ
うな値とする。また、ガベージコレクション処理S21
0が、GC稼動可否カウンタの値が0以下になった(S
2101のNo)ために終了したのではなく、繰り返し
処理S202の繰り返しが必要なくなった(S2002
のYes)ために終了した場合は、GC稼動可否カウン
タの値は0より大きい値となるが、これは0に戻される
ことなく、次の契機で一定値を加算する。ただし、加算
後のGC稼動可否カウンタの値が大きすぎる場合は適切
に調整する。なお、ガベージコレクション処理S210
は、応用プログラムと同時に動作契機が与えられるが、
両者が同時に動作可能な場合は、応用プログラムのほう
がガベージコレクション処理S210より優先して動作
するよう、制御する。
Next, the operation of the tenth embodiment will be described with reference to FIG. FIG. 20 is an explanatory diagram showing the operation of the tenth embodiment. The application program operates periodically at an appropriate period T1, and the GC operation availability counter adds an appropriate constant value in synchronization with the start of the application program. Is done. The value to be added to the GC operability counter is such a value that the garbage collection process S210 ends by the next operation of the application program even if the garbage collection process S210 is performed after the application program process is prolonged. And The garbage collection process S21
0 indicates that the value of the GC operation availability counter has become 0 or less (S
Therefore, the repetition of the repetition process S202 is not necessary (S2002).
(Yes), the value of the GC operation availability counter becomes a value larger than 0, but this value is not returned to 0, and a certain value is added at the next opportunity. However, if the value of the GC operation availability counter after the addition is too large, the value is appropriately adjusted. The garbage collection process S210
Is given an opportunity to operate simultaneously with the application program,
If both can operate at the same time, control is performed so that the application program operates prior to the garbage collection process S210.

【0196】本実施の形態10では上記のように、ガベ
ージコレクション処理S210は、応用プログラムのG
C稼動可否カウンタが0より大きい間で、かつ応用プロ
グラムの動作が中断しているか、または応用プログラム
の動作が終了しているときしか動作できないように制御
されるので、毎回のGC稼動可否カウンタの増加値を適
切に選ぶことにより、次の応用プログラムの動作契機ま
でにガベージコレクション処理S210の処理を終えさ
せることができ、実施の形態9同様、応用プログラムの
周期的動作を阻害せず、計算機システムの定応答性を向
上でき、さらに本実施の形態10では、実施の形態9よ
り、より周期毎にガベージコレクション処理S210へ
割当てる処理時間を一定に保つことができるので、応用
プログラムの動作が長引いた場合には、実施の形態9よ
り、よりガベージコレクション処理S210を長く動作
させることができるため、より多くの「ごみ」の回収が
でき、メモリ利用効率が向上する。
In the tenth embodiment, as described above, the garbage collection process S210 is performed in the G of the application program.
Since the control is performed so that the operation is possible only while the C operation availability counter is greater than 0 and the operation of the application program is interrupted or the operation of the application program is terminated, the GC operation availability counter is controlled every time. By appropriately selecting the increase value, the process of the garbage collection process S210 can be completed by the time of the next application program operation. As in the ninth embodiment, the periodic operation of the application program is not hindered. In the tenth embodiment, the processing time allocated to the garbage collection process S210 can be kept more constant in each cycle than in the ninth embodiment, so that the operation of the application program is prolonged. In this case, the garbage collection process S210 can be operated longer than in the ninth embodiment. Therefore, more and more of it is the recovery of the "garbage", memory utilization efficiency is improved.

【0197】なお、本実施の形態10においては、実施
の形態9同様、手順S201、S202、S202のそ
れぞれの処理を実行中には、途中で応用プログラムの処
理を優先させて応用プログラムの処理を行うことができ
ない場合でも、例えば実施の形態3の説明で言及したよ
うに、それらの処理の間ではガベージコレクション処理
を休止させ応用プログラムの動作ができるようにすれ
ば、応用プログラム実行中に一旦ガベージコレクション
処理が動作しても、その中断時間を短く抑えることがで
き、計算機システムの定応答性が向上できる。
In the tenth embodiment, similarly to the ninth embodiment, during execution of each of the steps S201, S202, and S202, the processing of the application program is prioritized in the middle of the processing of the application program. Even when the application program cannot be executed, for example, as described in the description of the third embodiment, if the garbage collection process is paused between the processes so that the operation of the application program can be performed, the garbage collection is temporarily performed during the execution of the application program. Even if the collection process operates, the interruption time can be kept short, and the constant response of the computer system can be improved.

【0198】また、本実施の形態10ではガベージコレ
クション処理S210の動作契機を応用プログラムの動
作契機と同時に与えられるとしたが、これも実施の形態
9同様、これは周期T1で動作するすべての応用プログ
ラムの動作が終了してからガベージコレクション処理S
210への動作契機が与えられるようにしてもよく、こ
の場合、応用プログラムの処理をより優先して行うこと
ができ、応用プログラムの動作の応答性をより向上させ
ることができる。
In the tenth embodiment, the operation of the garbage collection process S210 is given at the same time as the operation of the application program. However, similarly to the ninth embodiment, this is applied to all the applications operating in the cycle T1. Garbage collection processing S after the operation of the program ends
An operation trigger to 210 may be given. In this case, the processing of the application program can be performed with higher priority, and the responsiveness of the operation of the application program can be further improved.

【0199】さらに、本実施の形態10では、GC稼動
可否カウンタに整数値を用いたが、これは時刻を表す値
を用いて、手順S2102ではGC稼動可否カウンタに
対しS202の実行時間を減算するようにしてもよく、
この場合、ガベージコレクション処理S210に割当て
る時間をより厳密に制御できる。
Further, in the tenth embodiment, an integer value is used for the GC operation availability counter. However, this value is used to represent the time. In step S2102, the execution time of S202 is subtracted from the GC operation availability counter. You may do
In this case, the time allocated to the garbage collection process S210 can be more strictly controlled.

【0200】実施の形態11.この発明の実施の形態1
1は、応用プログラムとガベージコレクション処理の動
作タイミングに関するものであり、実施の形態10を改
善したものである。その基本構成は実施の形態3と同一
であるので説明を省略する。
Embodiment 11 FIG. Embodiment 1 of the present invention
Reference numeral 1 relates to the operation timing of the application program and the garbage collection process, which is an improvement of the tenth embodiment. The basic configuration is the same as that of the third embodiment, and the description is omitted.

【0201】図21は、本実施の形態11の動作を示す
フローチャートである。本実施の形態11におけるガベ
ージコレクション処理(GC処理)S220は、実施の
形態10同様、大きくは次の3つの段階、事前処理S2
01、繰り返される単位処理S202、事後処理S20
3から構成され、まずガベージコレクション処理のうち
繰り返し処理S202に入る前の準備として事前処理S
201を行った後、現状の残利用可能領域13が十分得
られているかを調べ(S2201)、もし十分であれば
(S2201のYes)、次にGC稼動可否カウンタを
検査し(S2101)、その値が0より大きくガベージ
コレクション処理を継続して良い状況であれば(S21
01のYes)、ガベージコレクション処理の繰り返し
処理S202を1単位処理分だけ実行する。なお、手順
S2201における残利用可能領域13の量の判断で
は、応用プログラムの動作挙動から、周期的に行うガベ
ージコレクション処理S220で少なくとも確保してお
く必要がある量に基づき判断することとし、もし手順S
2201で現状の残利用可能領域13が十分得られてい
なければ、手順S2101は割愛して速やかにガベージ
コレクション処理の繰り返し処理S202に移る。その
後は、まずGC稼動可否カウンタの値を1減じ(S21
02)、ついでさらに繰り返し処理を継続する必要があ
れば(S2002のNo)、残利用可能領域13が十分
回収できていないか(S2201のNo)、あるいはG
C稼動可否カウンタが0より大きい間(S2001のY
es)、繰り返し処理S202を繰り返し、繰り返し処
理S202を行う必要がなくなるか(S2002のYe
s)、残利用可能領域13が十分得られ(S2201の
Yes)、かつGC稼動可否カウンタの値が0以下とな
りガベージコレクション処理を継続できない状況であれ
ば(S2001のNo)、ガベージコレクション処理の
うち繰り返し処理S202の後始末として事後処理S2
03を行い、処理を終了する。
FIG. 21 is a flowchart showing the operation of the eleventh embodiment. The garbage collection process (GC process) S220 in the eleventh embodiment is roughly the following three stages, the pre-process S2, as in the tenth embodiment.
01, repeated unit processing S202, post processing S20
First, in the garbage collection process, a pre-processing S
After performing step 201, it is checked whether the current remaining available area 13 is sufficiently obtained (S2201). If it is enough (Yes in S2201), the GC operation availability counter is checked (S2101). If the value is larger than 0 and the garbage collection process can be continued (S21)
01 (Yes), the repetition process S202 of the garbage collection process is executed for one unit process. In the determination of the amount of the remaining available area 13 in step S2201, the determination is made based on at least the amount that needs to be secured in the periodic garbage collection process S220 based on the operation behavior of the application program. S
If the current remaining available area 13 is not sufficiently obtained in 2201, the procedure S2101 is omitted, and the process immediately proceeds to the repetition processing S202 of the garbage collection processing. After that, first, the value of the GC operation availability counter is reduced by 1 (S21).
02) Then, if it is necessary to continue the repetitive processing further (No in S2002), whether the remaining available area 13 has not been sufficiently collected (No in S2201) or G
While the C operation availability counter is greater than 0 (Y in S2001)
es), is it unnecessary to repeat the repetition process S202 and perform the repetition process S202 (Yes in S2002)
s) If the remaining available area 13 is sufficiently obtained (Yes in S2201), and the value of the GC operation availability counter is 0 or less and the garbage collection process cannot be continued (No in S2001), the garbage collection process is not performed. Post-processing S2 as the end of the repetition processing S202
03, and the process ends.

【0202】手順S201、S202、S203の詳細
は、実施の形態9及び実施の形態10と同じであるの
で、説明を省略する。
The details of steps S201, S202, and S203 are the same as those in the ninth and tenth embodiments, and a description thereof will not be repeated.

【0203】次に、本実施の形態11の動作について図
22を用いて説明する。図22は、本実施の形態11の
動作を示す解説図であり、応用プログラムは適切な周期
T1で周期的に動作し、GC稼動可否カウンタは応用プ
ログラム開始と同期して適切な一定値が加算される。な
お、GC稼動可否カウンタに加算する値は、応用プログ
ラムの処理が長引いた後に、ガベージコレクション処理
S220が行われても、応用プログラムの次の動作契機
までにはガベージコレクション処理S220が終わるよ
うな値とする。また、ガベージコレクションS210の
処理が、GC稼動可否カウンタの値が0以下になった
(S2101のNo)ために終了したのではなく、繰り
返し処理S202の繰り返しが必要なくなった(S20
02のYes)ために終了した場合は、GC稼動可否カ
ウンタの値は0より大きい値となるが、これは0に戻さ
れることなく、次の契機で一定値を加算する。ただし、
加算後のGC稼動可否カウンタの値が大きすぎる場合は
適切に調整する。同様に、ガベージコレクション処理S
220が、十分な残利用可能領域13をなかなか回収で
きずに終了した場合は、GC稼動可否カウンタの値が0
より小さい値となることがあるが、これも0に戻される
ことなく次の契機で一定値を加算する。ただし、この場
合も加算後のGC稼動可否カウンタの値が小さすぎる場
合は適切に調整する。なお、ガベージコレクション処理
S220は、応用プログラムと同時に動作契機が与えら
れるが、両者が同時に動作可能な場合は、応用プログラ
ムのほうがガベージコレクション処理S220より優先
して動作するよう、制御する。
Next, the operation of the eleventh embodiment will be described with reference to FIG. FIG. 22 is an explanatory diagram showing the operation of the eleventh embodiment. The application program operates periodically at an appropriate period T1, and the GC operation availability counter adds an appropriate constant value in synchronization with the start of the application program. Is done. The value to be added to the GC operability counter is a value such that even if the garbage collection processing S220 is performed after the application program processing is prolonged, the garbage collection processing S220 ends by the next operation of the application program. And Also, the processing of the garbage collection S210 is not terminated because the value of the GC operation availability counter has become 0 or less (No in S2101), and the repetition of the repetition processing S202 is no longer necessary (S20).
If the process is terminated because of Yes of 02), the value of the GC operation availability counter becomes a value larger than 0, but this value is not returned to 0, and a certain value is added at the next opportunity. However,
If the value of the GC operation availability counter after the addition is too large, it is adjusted appropriately. Similarly, garbage collection processing S
In the case where the process 220 is terminated without being able to collect a sufficient remaining available area 13 easily, the value of the GC operation availability counter is set to 0.
The value may be smaller, but this value is not returned to 0, and a constant value is added at the next opportunity. However, also in this case, if the value of the GC operation availability counter after the addition is too small, the value is appropriately adjusted. In the garbage collection process S220, an operation opportunity is given at the same time as the application program. However, when both can operate at the same time, control is performed so that the application program operates with priority over the garbage collection process S220.

【0204】本実施の形態11では上記のように、ガベ
ージコレクション処理S220は、応用プログラムの動
作が中断しているか、または応用プログラムの動作が終
了しているときで、かつ最低量の残利用可能領域13を
回収でき、さらに応用プログラムのGC稼動可否カウン
タが0より大きい間でしか動作できないように制御され
るので、毎回のGC稼動可否カウンタの増加値を適切に
選ぶことにより、次の応用プログラムの動作契機までに
ガベージコレクション処理S220の処理を終えさせる
ことができ、実施の形態9及び実施の形態10同様、応
用プログラムの周期的動作を阻害せず、計算機システム
の定応答性を向上できる。さらに、本実施の形態11で
は、実施の形態10同様、実施の形態9より、より周期
毎にガベージコレクション処理S220へ割当てる処理
時間を一定に保つことができるので、応用プログラムの
動作が長引いた場合には、実施の形態9より、よりガベ
ージコレクション処理S220を長く動作させることが
できるため、より多くの「ごみ」の回収ができ、メモリ
利用効率が向上する。加えて本実施の形態11では、実
施の形態10と比べ、毎回の周期で少なくとも一定量の
残利用可能領域13を確保するよう動作するので、応用
プログラム動作中での残利用可能領域13の不足による
メモリ獲得手段3のオブジェクト領域10の確保の失敗
が発生しにくくなり、応用プログラムの動作が安定し、
かつガベージコレクション処理S220の処理が長引い
た場合は次回の処理を短くするよう動作するので、計算
機システム全体の動作も安定する。
In the eleventh embodiment, as described above, the garbage collection process S220 is performed when the operation of the application program is interrupted or the operation of the application program is terminated and the minimum remaining available Since the area 13 can be collected and the operation is controlled so as to operate only while the GC operation availability counter of the application program is larger than 0, the next application program can be selected by appropriately selecting the increment value of the GC operation availability counter each time. The processing of the garbage collection process S220 can be completed by the time of the operation of, and the periodic response of the application program is not hindered and the constant response of the computer system can be improved as in the ninth and tenth embodiments. Furthermore, in the eleventh embodiment, as in the tenth embodiment, the processing time allocated to the garbage collection process S220 can be kept more constant in each cycle than in the ninth embodiment, so that the operation of the application program is prolonged. Since the garbage collection process S220 can be operated longer than in the ninth embodiment, more “garbage” can be collected and the memory use efficiency can be improved. In addition, in the eleventh embodiment, as compared with the tenth embodiment, an operation is performed so as to secure at least a fixed amount of the remaining available area 13 in each cycle. Failure to secure the object area 10 of the memory acquisition means 3 due to the above, the operation of the application program becomes stable,
In addition, when the garbage collection process S220 is prolonged, an operation is performed to shorten the next process, so that the operation of the entire computer system is stabilized.

【0205】なお、本実施の形態11においては、実施
の形態9及び実施の形態10同様、手順S201、S2
02、S202のそれぞれの処理を実行中には、途中で
応用プログラムの処理を優先させて応用プログラムの処
理を行うことができない場合でも、例えば実施の形態3
の説明で言及したように、それらの処理の間ではガベー
ジコレクション処理を休止させ応用プログラムの動作が
できるようにすれば、応用プログラム実行中に一旦ガベ
ージコレクション処理が動作しても、その中断時間を短
く抑えることができ、計算機システムの定応答性が向上
できる。
In the eleventh embodiment, as in the ninth and tenth embodiments, steps S201 and S2 are performed.
02 and S202, even if it is not possible to prioritize the processing of the application program and perform the processing of the application program on the way, for example, in the third embodiment.
As described in the description of the above, if the garbage collection process is paused between those processes so that the application program can operate, even if the garbage collection process operates once during the execution of the application program, the interruption time is reduced. It can be kept short, and the constant response of the computer system can be improved.

【0206】また、本実施の形態11ではガベージコレ
クション処理S220の動作契機を応用プログラムの動
作契機と同時に与えられるとしたが、これも実施の形態
9及び実施の形態10同様、これは周期T1で動作する
すべての応用プログラムの動作が終了してからガベージ
コレクション処理S220への動作契機が与えられるよ
うにしてもよく、この場合、応用プログラムの処理をよ
り優先して行うことができ、応用プログラムの動作の応
答性をより向上させることができる。
In the eleventh embodiment, the operation trigger of the garbage collection process S220 is given at the same time as the operation trigger of the application program. However, similarly to the ninth and tenth embodiments, this operation is performed at the cycle T1. An operation trigger to the garbage collection process S220 may be given after the operation of all running application programs is completed. In this case, the processing of the application programs can be performed with higher priority, and The responsiveness of the operation can be further improved.

【0207】さらに、本実施の形態11では、GC稼動
可否カウンタに整数値を用いたが、これは実施の形態1
0同様、時刻を表す値を用いて、手順S2102ではG
C稼動可否カウンタに対しS202の実行時間を減算す
るようにしてもよく、この場合、ガベージコレクション
処理S220に割当てる時間をより厳密に制御できる。
Further, in the eleventh embodiment, an integer value is used for the GC operation availability counter.
0, G is used in step S2102 by using a value representing the time.
The execution time of S202 may be subtracted from the C operation availability counter. In this case, the time allocated to the garbage collection process S220 can be more strictly controlled.

【0208】実施の形態12.この発明の実施の形態1
2に係る動的メモリ管理機構について図面を参照しなが
ら説明する。図23は、この発明の実施の形態12に係
る動的メモリ管理機構の構成を示すブロック図である。
図23において、動的メモリ管理機構1、ヒープ領域
2、ガベージコレクション手段5、オブジェクト領域1
0、ポインタ12、残利用可能領域13、既獲得済み領
域14は図7の実施の形態3と同じであるので説明を省
略する。残利用可能領域13内の利用可能なメモリ領域
はフリーリスト18により管理され、オブジェクト領域
10は、メモリ獲得手段3によりフリーリスト18内の
適切な領域が割当てられることで獲得され、獲得された
オブジェクト領域10は既獲得済み領域14の一部を構
成するようになる。また、オブジェクト領域10はメモ
リ開放手段4によりフリーリスト18に戻されることで
開放され、その領域は再利用可能となる。
Embodiment 12 FIG. Embodiment 1 of the present invention
2 will be described with reference to the drawings. FIG. 23 is a block diagram showing a configuration of a dynamic memory management mechanism according to Embodiment 12 of the present invention.
In FIG. 23, dynamic memory management mechanism 1, heap area 2, garbage collection means 5, object area 1
0, the pointer 12, the remaining available area 13, and the already acquired area 14 are the same as those in the third embodiment of FIG. The available memory area in the remaining available area 13 is managed by the free list 18, and the object area 10 is acquired by allocating an appropriate area in the free list 18 by the memory acquiring means 3, and the acquired object The area 10 constitutes a part of the already acquired area 14. Further, the object area 10 is released by being returned to the free list 18 by the memory releasing means 4, and the area can be reused.

【0209】次に、本実施の形態12の動作について説
明する。図24は、本実施の形態12におけるガベージ
コレクション処理(GC処理)の動作を示す全体のフロ
ーチャートである。本実施の形態12におけるガベージ
コレクション処理は、その起動契機により異なる動作を
し、起動契機が残利用可能領域13の不足により応用プ
ログラム稼働中にメモリ獲得手段3が応用プログラムか
ら要求された量のオブジェクト領域10を獲得できなか
ったことによる場合は(S2301の図中左分岐)、ま
ず既獲得済み領域14の一部に対し非コピー式の部分ガ
ベージコレクション処理を行い、残利用可能領域13内
のフリーリスト18の拡充を試み(S231)、必要な
オブジェクト領域10が確保できるようになれば(S2
302のYes)処理を終了し、手順S231だけでは
必要なオブジェクト領域10が確保できなければ(S2
302のNo)、実施の形態7(図14)における手順
1612と同様な方法で、必要なオブジェクト領域10
が確保できるように、コピーにより有効なオブジェクト
領域10の移動を行い、フリーリスト18にある複数の
利用可能なメモリ領域を単一のメモリ領域にまとめる
(S232)。一方、本ガベージコレクション処理S2
30の起動契機が、実施の形態9に示されるような定期
動作であった場合は(S2301の図中右分岐)、例え
ば第5の従来例に示したストップ−コピー方式のガベー
ジコレクション処理、あるいは実施の形態3ないし実施
の形態9に示したガベージコレクション処理などの、コ
ピー式のガベージコレクション処理を行い残利用可能領
域13を拡充する(S233)。
Next, the operation of the twelfth embodiment will be described. FIG. 24 is an overall flowchart showing the operation of the garbage collection process (GC process) in the twelfth embodiment. The garbage collection process according to the twelfth embodiment operates differently depending on the activation trigger, and when the activation trigger is activated, the memory acquisition unit 3 operates the application program while the application program is running due to a shortage of the remaining available area 13. If the area 10 has not been acquired (left branch in S2301 in the drawing), first, a non-copy-type partial garbage collection process is performed on a part of the already acquired area 14 and the free area in the remaining available area 13 is obtained. Attempt to expand the list 18 (S231), and if the necessary object area 10 can be secured (S2)
302 (Yes in 302), and if the necessary object area 10 cannot be secured by only step S231 (S2).
302), the necessary object area 10 is determined in the same manner as the procedure 1612 in the seventh embodiment (FIG. 14).
Then, the effective object area 10 is moved by copying so that the available memory areas can be secured, and a plurality of available memory areas in the free list 18 are collected into a single memory area (S232). On the other hand, this garbage collection processing S2
In the case where the activation trigger of 30 is a regular operation as shown in the ninth embodiment (right branch in the drawing of S2301), for example, the garbage collection process of the stop-copy method shown in the fifth conventional example, or A copy-type garbage collection process such as the garbage collection process described in the third to ninth embodiments is performed to expand the remaining available area 13 (S233).

【0210】次に、手順S231に示した、既獲得済み
領域14の一部に対する非コピー式の部分ガベージコレ
クション処理(非コピー式部分GC処理)の詳細を示
す。図25は、本実施の形態9におけるガベージコレク
ション処理の動作を示す非コピー式の部分ガベージコレ
クション処理のフローチャートである。本動作では、ま
ず既獲得済み領域14のうち適切な大きさをFROM領
域16と定め(S2311)、FROM領域16内にあ
るすべてのオブジェクト領域を一旦フリーリスト18に
つなぐ(S2312)。次に、大きく以下の3つの段階
を踏み、FROM領域16内の「生きている」オブジェ
クト領域10を抽出し、フリーリスト18からはずす。
次に、計算機のCPUレジスタ、プログラムが静的に配
置したメモリ領域、あるいはスタック内の変数としてヒ
ープ領域2の外部に存在するすべてのポインタ12につ
いて、それらのポインタ12から直接参照されるFRO
M領域16内のオブジェクト領域10を探索し、未検出
のオブジェクト領域10があれば、同オブジェクト領域
10をフリーリスト18から抜き有効オブジェクト領域
リストへ追加する(S235)。次に、既獲得済み領域
14のうちFROM領域16以外にあるすべてのオブジ
ェクト領域10を探索し、それらのオブジェクト領域1
0から直接参照されるFROM領域16内のオブジェク
ト領域10についても、未検出のオブジェクト領域10
であれば、同オブジェクト領域10をフリーリスト18
から抜き有効オブジェクト領域リストへ追加する(S2
36)。最後に、有効オブジェクト領域リストを探索
し、有効オブジェクト領域リストにあるオブジェクト領
域10から参照されるFROM領域16内のオブジェク
ト領域10についても、未検出であればフリーリスト1
8から抜き有効オブジェクト領域リストへ追加し(S2
37)、処理を終了する。手順S235、S236、S
237により、ヒープ領域外のポインタ12からと既獲
得済み領域14のうちFROM領域16以外に存在する
オブジェクト領域10から直接または間接に参照できる
すべてのオブジェクト領域10はフリーリスト18から
抜かれ有効オブジェクト領域リストに登録されたので、
本段階でFROM領域16に存在し、かつ有効オブジェ
クト領域リストに登録されず、まだフリーリスト18に
つながっているオブジェクト領域10は「ごみ」とみな
すことができる。
Next, details of the non-copy type partial garbage collection process (non-copy type partial GC process) for a part of the already acquired area 14 shown in step S231 will be described. FIG. 25 is a flowchart of a non-copy-type partial garbage collection process showing the operation of the garbage collection process in the ninth embodiment. In this operation, first, an appropriate size of the already acquired area 14 is determined as the FROM area 16 (S2311), and all object areas in the FROM area 16 are temporarily connected to the free list 18 (S2312). Next, the “living” object area 10 in the FROM area 16 is extracted and removed from the free list 18 through the following three steps.
Next, with respect to all the pointers 12 existing outside the heap area 2 as variables in the CPU register of the computer, the memory area statically allocated by the program, or the stack, the FRO directly referred to by the pointers 12 is used.
The object area 10 in the M area 16 is searched, and if there is an undetected object area 10, the object area 10 is removed from the free list 18 and added to the valid object area list (S235). Next, all the object areas 10 other than the FROM area 16 in the already acquired area 14 are searched, and those object areas 1 are searched.
The object area 10 in the FROM area 16 which is directly referred to from 0
If so, the object area 10 is stored in the free list 18
And adds it to the valid object area list (S2
36). Finally, the valid object area list is searched, and the object list 10 in the FROM area 16 referred to from the object areas 10 in the valid object area list is also detected in the free list 1 if not detected.
8 and added to the valid object area list (S2
37), end the processing. Procedures S235, S236, S
In accordance with 237, all object areas 10 that can be directly or indirectly referred to from the pointer 12 outside the heap area and the object area 10 existing in the acquired area 14 other than the FROM area 16 are removed from the free list 18 and the effective object area list Since registered
At this stage, the object area 10 existing in the FROM area 16 and not registered in the valid object area list and still connected to the free list 18 can be regarded as “garbage”.

【0211】次に、手順S235、手順S236、手順
S237の詳細を示す。
Next, details of step S235, step S236, and step S237 will be described.

【0212】手順S235では、まずヒープ領域2外に
ある適切なポインタ12の1つを選択し(P141
1)、そのポインタ12が有効でFROM領域16内に
ある未検出のオブジェクト領域10を参照していれば
(S1621のYes)、ポインタ12が参照するオブ
ジェクト領域10をフリーリスト18から抜き有効オブ
ジェクト領域リストに追加登録し(S2351)、本手
順をヒープ領域2の外にあるすべてのポインタ12につ
いて繰り返す(P1413のYes、P1414)。
In step S235, first, one of the appropriate pointers 12 outside the heap area 2 is selected (P141).
1) If the pointer 12 is valid and refers to the undetected object area 10 in the FROM area 16 (Yes in S1621), the object area 10 referred to by the pointer 12 is removed from the free list 18 and the valid object area This procedure is additionally registered in the list (S2351), and this procedure is repeated for all pointers 12 outside the heap area 2 (Yes in P1413, P1414).

【0213】手順S236では、既獲得済み領域14の
うちFROM領域16以外にオブジェクト領域10があ
れば(S1411のYes)、まず該当するオブジェク
ト領域10を1つ選択し(S1412)、選択したオブ
ジェクト領域10が内部にポインタ12を含めば(P1
313のYes)、まず選択したオブジェクト領域10
に含まれるポインタ12の1つを選び(P1314)、
その値が有効でFROM領域16内にある未検出のオブ
ジェクト領域10を参照していれば(S1621のYe
s)、参照先のオブジェクト領域10をフリーリスト1
8から抜き有効オブジェクト領域リストに追加登録し
(S2351)、本手順を選択したオブジェクト領域1
0の内部に含まれるすべてのポインタ12に繰り返し行
い(P1315のNo)、さらに既獲得済み領域14の
うちFROM領域16以外にあるオブジェクト領域10
のすべてについて上記手順を繰り返す(S1413のN
o)。
In step S236, if there is an object area 10 other than the FROM area 16 in the already acquired area 14 (Yes in S1411), one corresponding object area 10 is selected first (S1412), and the selected object area 10 is selected. If 10 includes a pointer 12 inside (P1
313, Yes), first, the selected object area 10
Is selected (P1314),
If the value is valid and refers to the undetected object area 10 in the FROM area 16 (Yes in S1621)
s), a free list 1 of the referenced object area 10
8 and is additionally registered in the valid object area list (S2351), and the object area 1 in which this procedure is selected
0 is repeated for all the pointers 12 included in the area 0 (No in P1315), and the object area 10 in the acquired area 14 other than the FROM area 16
The above procedure is repeated for all of the steps (N in S1413)
o).

【0214】手順S237では、有効オブジェクト領域
リストに未処理のオブジェクト領域10があれば(S1
641のYes)、有効オブジェクト領域リストからま
ず該当するオブジェクト領域10を1つ選択し(S16
42)、選択したオブジェクト領域10が内部にポイン
タ12を含めば(P1313のYes)、まず選択した
オブジェクト領域10に含まれるポインタ12の1つを
選び(P1314)、その値が有効でFROM領域16
内にある未検出のオブジェクト領域10を参照していれ
ば(S1621のYes)、参照先のオブジェクト領域
10をフリーリスト18から抜き有効オブジェクト領域
リストに追加登録し(S2351)、本手順を選択した
オブジェクト領域10の内部に含まれるすべてのポイン
タ12に繰り返し行い(P1315のNo)、さらに有
効オブジェクト領域リストに登録されているオブジェク
ト領域10のすべてについて上記手順を繰り返す(S1
643のNo)。
In step S237, if there is an unprocessed object area 10 in the valid object area list (S1
641), and first selects one corresponding object area 10 from the effective object area list (S16).
42), if the selected object area 10 includes the pointer 12 inside (Yes in P1313), first, one of the pointers 12 included in the selected object area 10 is selected (P1314), and the value is valid and the FROM area 16 is selected.
If an undetected object area 10 is referred to (Yes in S1621), the reference target object area 10 is removed from the free list 18 and added to the valid object area list (S2351), and this procedure is selected. This is repeated for all the pointers 12 included in the object area 10 (No in P1315), and the above procedure is repeated for all the object areas 10 registered in the valid object area list (S1).
No. 643).

【0215】本実施の形態12は上記のように、ガベー
ジコレクション処理S230の起動契機に応じて、その
処理内容を変更するようにしたので、ガベージコレクシ
ョン処理S230の起動契機が、残利用可能領域13の
不足により応用プログラム稼働中にメモリ獲得手段3が
応用プログラムから要求された量のオブジェクト領域1
0を獲得できなかったことによる場合では、応用プログ
ラムの中断時間ができるだけ短くなるように動作し、一
方、その起動契機が周期的に予定されている定期動作で
は、残利用可能領域13内の利用可能なメモリ領域をで
きるだけ大きく連続した領域となるようにし、応用プロ
グラムの中断が起こりにくくなるように動作し、これに
より応用プログラムの動作の応答性を向上することがで
きる。
As described above, in the twelfth embodiment, the content of the garbage collection process S230 is changed in response to the activation of the garbage collection process S230. Due to lack of memory, the memory acquisition means 3 operates the application program and the amount of object area 1 requested by the application program is reduced.
In the case where 0 cannot be acquired, the application program operates so that the interruption time of the application program is shortened as much as possible. The possible memory area is made to be a continuous area as large as possible, and the operation is performed so that the interruption of the application program is less likely to occur, whereby the responsiveness of the operation of the application program can be improved.

【0216】なお、本実施の形態12では、応用プログ
ラム稼働中の残利用可能領域13不足時は、まず、第3
の従来例に示したマーク−スイープ方式に準じた非コピ
ー式部分ガベージコレクション処理S231を行い、つ
いで手順S232でさらにフリーリスト18内の利用可
能なメモリ領域を単一の領域にまとめるようにしたが、
必要としているオブジェクト領域を獲得するに足る残利
用可能領域13を早く確保できる方式であれば、どのよ
うなガベージコレクション方式であっても代えることが
でき、例えば手順S231に代えマーク−スイープ方
式、あるいは類する他の方式を既獲得済み領域14に対
し部分的あるいは全体に利用することでも同じ効果を得
ることが出来、さらに手順S231と手順S232をま
とめ、例えば実施の形態7(図13、図14)における
部分コンパクト処理S161や、あるいは第4の従来例
に示したマーク−コンパクト方式のガベージコレクショ
ン処理に代えることでも、同じ効果を得ることができ
る。同様に、本実施の形態12の定期動作時の処理は、
できるだけ多くの残利用可能領域13を効率よく集めら
れる方式であれば、どのようなガベージコレクション方
式であっても代えることができる。さらに本実施の形態
12に対し、第1ないし第2の従来例、または実施の形
態1ないし実施の形態2に示したような、参照カウンタ
方式のガベージコレクション処理を併用することで、応
用プログラム稼働中の残利用可能領域13不足の発生
を、より抑制することができる。
In the twelfth embodiment, when the remaining available area 13 is insufficient during the operation of the application program, the third
The non-copy type partial garbage collection process S231 according to the mark-sweep method shown in the conventional example of the prior art is performed, and then in step S232, the available memory areas in the free list 18 are combined into a single area. ,
Any garbage collection method can be used as long as the remaining available area 13 enough to obtain the required object area can be secured quickly. For example, a mark-sweep method instead of step S231, or The same effect can be obtained by partially or entirely using another similar method to the already acquired area 14, and further, the procedure S231 and the procedure S232 are summarized, for example, in the seventh embodiment (FIGS. 13 and 14). The same effect can be obtained by substituting the partial compact processing S161 in, or the mark-compact garbage collection processing shown in the fourth conventional example. Similarly, the processing at the time of the periodic operation of the twelfth embodiment is as follows.
Any garbage collection method can be used as long as the remaining available area 13 can be efficiently collected as much as possible. Furthermore, by using the garbage collection process of the reference counter method as shown in the first or second conventional example or the first or second embodiment in combination with the twelfth embodiment, the application program can be operated. The occurrence of the shortage of the remaining available area 13 in the inside can be further suppressed.

【0217】実施の形態13.この発明の実施の形態1
3は、ガベージコレクション処理が、実施の形態12と
は別の条件によって、その起動契機の状況に応じて異な
る動作をするものである。その基本構成は実施の形態1
2の構成と同一であるので説明を省略する。
Embodiment 13 FIG. Embodiment 1 of the present invention
No. 3 shows that the garbage collection process operates differently depending on the condition of the activation trigger under different conditions from the twelfth embodiment. The basic configuration is the first embodiment.
Since the configuration is the same as that of the second embodiment, the description is omitted.

【0218】図26は、本実施の形態13の動作を示す
フローチャートである。本実施の形態13におけるガベ
ージコレクション処理(GC処理)S240は、その起
動契機の状態により異なる動作をし、前回ガベージコレ
クション処理が行われてから、今回の起動までにメモリ
獲得手段3によって獲得されたオブジェクト領域10の
数が少なかった場合は(S2401の図中左分岐)、第
5の従来例に示したストップ−コピー式のガベージコレ
クション処理を行い(S241)、一方、今回の起動ま
でにメモリ獲得手段3によって獲得されたオブジェクト
領域10の数が多かった場合は(S2402の図中右分
岐)、第3の従来例に示したマーク−スイープ方式のガ
ベージコレクション処理を行う(S242)。
FIG. 26 is a flowchart showing the operation of the thirteenth embodiment. The garbage collection process (GC process) S240 in the thirteenth embodiment operates differently depending on the state of the activation trigger, and is acquired by the memory acquisition unit 3 from the time when the garbage collection process was last performed to the time when the current activation. If the number of object areas 10 is small (left branch in S2401 in the figure), the stop-copy type garbage collection process shown in the fifth conventional example is performed (S241), and on the other hand, memory is acquired by the time of this activation. If the number of object areas 10 acquired by the means 3 is large (right branch in S2402 in the figure), the garbage collection process of the mark-sweep method shown in the third conventional example is performed (S242).

【0219】第3および第5の従来例で示したように、
ストップ−コピー方式ではマーク−スイープ方式の問題
であるフラグメンテーション現象の発生を避けることが
できるが、その処理内にオブジェクト領域のコピー動作
が入るため、同じ数のオブジェクト領域を扱う場合マー
ク−スイープ方式より処理時間が長くなるという問題点
がある。しかし、本実施の形態13は上記のように、ガ
ベージコレクション処理S240の起動契機における状
態に応じて両者を使い分けるようにしたので、ガベージ
コレクション処理に要する処理時間を、前回ガベージコ
レクション処理後に新たに獲得されたオブジェクト領域
10の数に関わらず、できるだけ一定に保ちつつ、適宜
ストップ−コピー方式を行うことでフラグメンテーショ
ン現象発生を回避することができ、計算機システムの動
作を安定させることができる。
As shown in the third and fifth conventional examples,
In the stop-copy method, the fragmentation phenomenon which is a problem of the mark-sweep method can be avoided. However, since the copy operation of the object area is included in the processing, the mark-sweep method is used when the same number of object areas are handled. There is a problem that processing time becomes long. However, in the thirteenth embodiment, as described above, the two are selectively used depending on the state at the time of the start of the garbage collection process S240, so that the processing time required for the garbage collection process is newly acquired after the previous garbage collection process. Irrespective of the number of the object areas 10, the stop-copy method is appropriately performed while keeping the object area 10 as constant as possible, so that the occurrence of the fragmentation phenomenon can be avoided, and the operation of the computer system can be stabilized.

【0220】なお、本実施の形態13では、前回ガベー
ジコレクション処理後に新たに獲得されたオブジェクト
領域10の数によって、どちらのガベージコレクション
方式を用いるかの判断を行っているが、本判断は固定的
な閾値による判断ではなく、例えば過去の履歴を元に適
用的に閾値を定め判断するようにしても同様の効果を得
られる。また、前回ガベージコレクション処理後に新た
に獲得されたオブジェクト領域10に関して、そのの数
だけでなく、その総量も判断に用いても良く、あるいは
前回ガベージコレクション処理後に新たに獲得されたオ
ブジェクト領域10に関してではなく、ガベージコレク
ション処理起動契機時点で「生きてきる」とみなされる
オブジェクト領域10に関する指標、さらには他の指標
を用いても本実施の形態13と同様の効果を得ることが
できる。
In the thirteenth embodiment, which garbage collection method is used is determined based on the number of object areas 10 newly acquired after the previous garbage collection process. However, this determination is fixed. The same effect can be obtained even if the threshold value is adaptively determined based on the past history, for example, instead of the determination based on the appropriate threshold value. In addition, regarding the object area 10 newly acquired after the previous garbage collection process, not only the number of the object area 10 but also the total amount thereof may be used for the determination, or the object area 10 newly acquired after the previous garbage collection process may be used. However, the same effect as that of the thirteenth embodiment can be obtained by using an index related to the object area 10 that is regarded as “living” at the time of starting the garbage collection process, and further using other indices.

【0221】また、本実施の形態13では、マーク−ス
イープ方式とストップ−コピー方式を併用するようにし
たが、これらの方式は両者をインクリメンタル化した方
式に代えてよく、さらには他の既存技術、ないしこの発
明にかかる他の実施の形態に挙げた他の方式で代えても
良く、さらに3種ないしそれ以上の方式を併用をしても
よい。
Further, in the thirteenth embodiment, the mark-sweep method and the stop-copy method are used in combination. However, these methods may be replaced with a method in which both are made incremental, and furthermore, other existing technologies are used. Alternatively, the other methods described in the other embodiments according to the present invention may be replaced, and three or more methods may be used in combination.

【0222】実施の形態14.この発明の実施の形態1
4は、ガベージコレクション処理が、実施の形態12及
び実施の形態13とは別の条件によって、その起動契機
の状況に応じて異なる動作をするものである。その基本
構成は実施の形態12の構成と同一であるので説明を省
略する。
Embodiment 14 FIG. Embodiment 1 of the present invention
No. 4 shows that the garbage collection process operates differently depending on the condition of the activation trigger under different conditions from the twelfth and thirteenth embodiments. The basic configuration is the same as that of the twelfth embodiment, and the description is omitted.

【0223】図27は、本実施の形態14の動作を示す
フローチャートである。本実施の形態14におけるガベ
ージコレクション処理(GC処理)S250は、計算機
システムの立ち上げ段階であった場合は、残利用可能領
域13の不足により応用プログラム稼働中にメモリ獲得
手段3が応用プログラムから要求された量のオブジェク
ト領域10を獲得できなかったことによる場合のみ起動
され、計算機システムの定常段階では、実施の形態9に
示したように一定の周期で定期的に起動される。このた
め本実施の形態14のガベージコレクション処理S25
0は、その起動時が計算機システムの立ち上げ段階であ
った場合は(S2501の図中左分岐)、まず第3の従
来例として示したマーク−スイープ方式のガベージコレ
クション処理を行い(S251)、必要なオブジェクト
領域10が確保できるようになれば(S2302のYe
s)処理を終了し、手順S251だけでは必要なオブジ
ェクト領域10が確保できなければ(S2302のN
o)、実施の形態7(図14)における手順1612と
同様な方法で、必要なオブジェクト領域10が確保でき
るように、コピーにより有効なオブジェクト領域10の
移動を行い、フリーリスト18にある複数の利用可能な
メモリ領域を単一のメモリ領域にまとめる(S23
2)。一方、本ガベージコレクション処理S250の起
動時が計算機システムの定常状態であった場合は(S2
501の図中右分岐)、例えば実施の形態3ないし実施
の形態9に示した本発明にかかるガベージコレクション
処理などにより、既獲得済み領域14の一部に対しコピ
ー式のガベージコレクション処理を行い残利用可能領域
13を拡充する(S253)。
FIG. 27 is a flowchart showing the operation of the fourteenth embodiment. In the garbage collection process (GC process) S250 in the fourteenth embodiment, when the computer system has been started up, the memory acquisition unit 3 requests from the application program while the application program is running due to the lack of the remaining available area 13. It is started only when the specified amount of the object area 10 cannot be obtained, and is started periodically at a constant cycle as shown in the ninth embodiment in the steady stage of the computer system. For this reason, the garbage collection process S25 of the fourteenth embodiment
If the start time is the start-up stage of the computer system (left branch in S2501 in the drawing), first, the garbage collection process of the mark-sweep method shown as the third conventional example is performed (S251). If the necessary object area 10 can be secured (Ye in S2302)
s) The process ends, and if the necessary object area 10 cannot be secured by only the step S251 (N in S2302)
o) In a manner similar to the procedure 1612 in the seventh embodiment (FIG. 14), the valid object area 10 is moved by copying so that the necessary object area 10 can be secured, and a plurality of objects in the free list 18 are moved. Combine available memory areas into a single memory area (S23)
2). On the other hand, when the garbage collection process S250 is started in a steady state of the computer system (S2
501, a garbage collection process according to the present invention shown in the third to ninth embodiments, for example, performs a copy-type garbage collection process on a part of the already-acquired area 14 and performs a remaining process. The usable area 13 is expanded (S253).

【0224】本実施の形態14は上記のように、ガベー
ジコレクション処理S230の起動契機における計算機
システムの稼動状況に応じて処理内容を変更するように
したので、計算機システムの立ち上げ段階では、立ち上
げに要する処理時間を短くするようガベージコレクショ
ン処理を行い、計算機システムの定常段階では、応用プ
ログラムの動作の応答性が良いようにガベージコレクシ
ョン処理を行うことができる。
In the fourteenth embodiment, as described above, the processing contents are changed in accordance with the operation status of the computer system at the time of the start of the garbage collection process S230. Garbage collection processing is performed so as to shorten the processing time required for the garbage collection, and the garbage collection processing can be performed in a normal stage of the computer system so that the responsiveness of the operation of the application program is good.

【0225】なお、本実施の形態14では、計算機シス
テムの立ち上げ段階では、まず第3の従来例に示したマ
ーク−スイープ方式のガベージコレクション処理S25
1を行い、ついで手順S252でさらにフリーリスト1
8内の利用可能なメモリ領域を単一の領域にまとめるよ
うにしたが、本手順は、計算機システムの立ち上げ段階
の全体の処理時間を短くできるような方式であれば、ど
のような方式に代えても良く、同様に計算機システムの
定常段階では、応用プログラムの動作の応答性を向上で
きる方式であれば、どのような方式に代えても良い。
In the fourteenth embodiment, at the start-up stage of the computer system, first, the mark-sweep garbage collection process S25 shown in the third conventional example is performed.
1 and then the free list 1 in step S252.
8, the available memory areas are combined into a single area. However, the present procedure is applicable to any method that can shorten the entire processing time of the start-up phase of the computer system. Similarly, in the normal stage of the computer system, any method may be used as long as the response of the operation of the application program can be improved.

【0226】実施の形態15.この発明の実施の形態1
5は、実施の形態12と実施の形態14を合成し、改良
したものであり、ガベージコレクション処理が、より複
合した条件によって、その起動契機の状況に応じた異な
る動作をするものである。その基本構成は実施の形態1
2の構成と同一であるので説明を省略する。
Embodiment 15 FIG. Embodiment 1 of the present invention
5 is obtained by synthesizing and improving the twelfth and fourteenth embodiments, in which the garbage collection process performs different operations according to the conditions of the activation trigger according to more complex conditions. The basic configuration is the first embodiment.
Since the configuration is the same as that of the second embodiment, the description is omitted.

【0227】図28は、本実施の形態15の動作を示す
フローチャートである。本実施の形態15におけるガベ
ージコレクション処理(GC処理)S260は、残利用
可能領域13の不足により応用プログラム稼働中にメモ
リ獲得手段3が応用プログラムから要求された量のオブ
ジェクト領域10を獲得できなかったことによる場合に
起動され、また計算機システムの定常段階においては、
実施の形態9に示したように一定の周期で定期的に起動
される。このため本実施の形態15のガベージコレクシ
ョン処理S250は、その起動時が計算機システムの立
ち上げ段階であった場合は(S2501の図中下分
岐)、既獲得済み領域14全体を処理対象として(S2
601)、まず対象領域に対し第3の従来例として示し
たマーク−スイープ式、あるいは実施の形態12(図2
5)の手順S231に準じた非コピー式のガベージコレ
クション処理を行い(S261)、必要なオブジェクト
領域10が確保できるようになれば(S2302のYe
s)処理を終了し、手順S261だけでは必要なオブジ
ェクト領域10が確保できなければ(S2302のN
o)、実施の形態7(図14)における手順1612と
同様な方法で、必要なオブジェクト領域10が確保でき
るように、コピーにより有効なオブジェクト領域10の
移動を行い、フリーリスト18にある複数の利用可能な
メモリ領域を単一のメモリ領域にまとめる(S23
2)。一方、本ガベージコレクション処理S260の起
動時が計算機システムの定常段階であった場合は(S2
501の図中右分岐)、次にガベージコレクション処理
の起動契機について判断を行い(S2301)、もし起
動契機が残利用可能領域13の不足により応用プログラ
ム稼働中にメモリ獲得手段3が応用プログラムから要求
された量のオブジェクト領域10を獲得できなかったこ
とによる場合は(S2301の図中下分岐)、既獲得済
み領域14の一部を処理対象として(S2602)、手
順261を行い、必要なオブジェクト領域10が確保で
きるようになれば処理を終えるが(S2302のYe
s)、手順S261だけでは必要なオブジェクト領域1
0が確保できなければ(S2302のNo)、さらに手
順S232を行う。また、ガベージコレクション処理S
260の起動時が計算機システムの定常段階であって
(S2501の図中右分岐)、ガベージコレクション処
理の起動契機が実施の形態9に示されるような定期動作
であった場合は(S2301の図中右分岐)、まず例え
ば実施の形態3ないし実施の形態9に示したガベージコ
レクション処理などにより、既獲得済み領域の一部に対
しコピー式のガベージコレクション処理を行い残利用可
能領域を拡充し(S253)、定期的な動作で確保すべ
き残利用可能領域13を得られれば(S2603のYe
s)処理を終了し、未だ残利用可能領域13が不足する
場合は(S2603のNo)、さらに対象領域を広げ既
獲得済み領域14全体に対し再びコピー式のガベージコ
レクション処理を行い残利用可能領域13を拡充する
(S264)。
FIG. 28 is a flowchart showing the operation of the fifteenth embodiment. In the garbage collection process (GC process) S260 in the fifteenth embodiment, the memory acquisition unit 3 could not acquire the object area 10 requested by the application program during the operation of the application program due to the shortage of the remaining available area 13. In the normal stage of the computer system,
As described in the ninth embodiment, it is started periodically at a constant cycle. For this reason, if the garbage collection process S250 of the fifteenth embodiment is in the startup stage of the computer system (lower branch in S2501 in the figure), the entire acquired area 14 is processed (S2).
601), the mark-sweep type shown as the third conventional example for the target area, or the twelfth embodiment (FIG.
The non-copy-type garbage collection process according to the procedure S231 of 5) is performed (S261), and if the necessary object area 10 can be secured (Ye in S2302)
s) The process ends, and if the necessary object area 10 cannot be secured by only the step S261 (N in S2302)
o) In a manner similar to the procedure 1612 in the seventh embodiment (FIG. 14), the valid object area 10 is moved by copying so that the necessary object area 10 can be secured, and a plurality of objects in the free list 18 are moved. Combine available memory areas into a single memory area (S23)
2). On the other hand, when the garbage collection process S260 is started at the steady stage of the computer system (S2
501 (right branch in the figure), and then determine the start timing of the garbage collection process (S2301). If the start timing is insufficient for the remaining available area 13, the memory acquisition means 3 requests from the application program while the application program is running. If the required amount of object area 10 cannot be obtained (lower branch in S2301 in the figure), a part of the already obtained area 14 is to be processed (S2602), and the procedure 261 is performed to execute the necessary object area. The process ends when 10 can be secured (Ye in S2302).
s), object area 1 required only in step S261
If 0 cannot be secured (No in S2302), step S232 is further performed. The garbage collection process S
If the start of step 260 is a normal stage of the computer system (right branch in S2501 in the figure) and the start of the garbage collection process is a periodic operation as shown in the ninth embodiment (see the figure of S2301) (Right branch) First, copy-type garbage collection processing is performed on a part of the already acquired area by, for example, the garbage collection processing described in Embodiments 3 to 9 to expand the remaining available area (S253). ), If the remaining available area 13 to be secured by the periodic operation can be obtained (Yes in S2603)
s) When the processing is completed and the remaining available area 13 is still insufficient (No in S2603), the target area is further expanded and the copy-type garbage collection process is performed again on the entire acquired area 14 to perform the remaining available area. 13 is expanded (S264).

【0228】本実施の形態15は上記のように、ガベー
ジコレクション処理S260の起動契機における計算機
システムの稼動状況と、ガベージコレクション処理S2
60の起動契機に応じて処理内容を変更するようにした
ので、実施の形態14同様、計算機システムの立ち上げ
段階では、立ち上げに要する処理時間を短くすることが
でき、一方、計算機システムの定常段階においては、実
施の形態12同様、その起動契機が残利用可能領域13
の不足により応用プログラム稼働中にメモリ獲得手段3
が応用プログラムから要求された量のオブジェクト領域
10を獲得できなかった場合では、応用プログラムの中
断時間ができるだけ短くなるように動作し、さらに起動
契機が定常段階において周期的に予定されている定期動
作では、処ガベージコレクション処理の負荷を抑えつ
つ、残利用可能領域13内の利用可能なメモリ領域をで
きるだけ大きく連続した領域となるようにし、応用プロ
グラムの中断が起こりにくくなるように動作し、これに
より応用プログラムの動作の応答性を向上することがで
きる。
In the fifteenth embodiment, as described above, the operating status of the computer system at the time of starting the garbage collection process S260 and the garbage collection process S2
Since the processing contents are changed in response to the start timing of the computer system 60, the processing time required for the startup can be reduced in the startup stage of the computer system, as in the fourteenth embodiment. In the stage, as in the twelfth embodiment, the activation trigger is the remaining available area 13
Memory acquisition means 3 during application program operation due to lack of
Does not obtain the object area 10 of the required amount from the application program, it operates so that the interruption time of the application program becomes as short as possible. Then, while suppressing the load of the garbage collection processing, the available memory area in the remaining available area 13 is made to be a continuous area as large as possible, and the operation is performed so that interruption of the application program hardly occurs. The responsiveness of the operation of the application program can be improved.

【0229】なお、本実施の形態15では、計算機シス
テムの立ち上げ段階では、まず第3の従来例に示したマ
ーク−スイープ方式のガベージコレクション処理S25
1を行い、ついで手順S252でさらにフリーリスト1
8内の利用可能なメモリ領域を単一の領域にまとめるよ
うにしたが、本手順は、計算機システムの立ち上げ段階
の全体の処理時間を短くできるような方式であれば、ど
のような方式に代えても良く、同様に計算機システムの
定常段階では、応用プログラムの動作の応答性を向上で
きる方式であれば、どのような方式に代えても良い。ま
た本実施の形態15に対し、第1ないし第2の従来例、
または実施の形態1ないし実施の形態2に示したよう
な、参照カウンタ方式のガベージコレクション処理を併
用することで、応用プログラム稼働中の残利用可能領域
13不足の発生を、より抑制することができる。
In the fifteenth embodiment, at the start-up stage of the computer system, first, the garbage collection process S25 of the mark-sweep system shown in the third conventional example is performed.
1 and then the free list 1 in step S252.
8, the available memory areas are combined into a single area. However, the present procedure is applicable to any method that can shorten the entire processing time of the start-up phase of the computer system. Similarly, in the normal stage of the computer system, any method may be used as long as the response of the operation of the application program can be improved. In addition, a first or second conventional example,
Alternatively, by using the garbage collection process of the reference counter method as described in the first and second embodiments, it is possible to further suppress the shortage of the remaining available area 13 during the operation of the application program. .

【0230】さらに、実施の形態12〜実施の形態15
において、その判断条件を変更ないし追加し、また条件
に応じて実行するガベージコレクション方式も変更ない
し追加することで、ガベージコレクション処理の契機と
なった理由、プログラムの動作状況、動的メモリ管理機
構1の内部状態、システムの稼動状況、その他のシステ
ム状態に応じて、異なる動作特性のガベージコレクショ
ン方式を適宜使い分けるガベージコレクション処理へ容
易に展開でき、これにより計算機システムや応用プログ
ラムの動作の状況に応じてガベージコレクション処理に
要求される動作特性を適宜変化させ、最適な動作特性を
実現し、計算機システムの性能を向上させることができ
る。
Further, the twelfth to fifteenth embodiments
In the above, by changing or adding the judgment condition and changing or adding the garbage collection method executed according to the condition, the reason for the trigger of the garbage collection process, the operation state of the program, the dynamic memory management mechanism 1 The garbage collection method can be easily applied to different operating characteristics according to the internal state of the system, the operating state of the system, and other system states. The operating characteristics required for the garbage collection process can be changed as appropriate to achieve optimal operating characteristics and improve the performance of the computer system.

【0231】実施の形態16.この発明の実施の形態1
6は、応用プログラムとガベージコレクション処理の動
作タイミングに関するものである。その基本構成は実施
の形態3の構成と同一であるので説明を省略する。
Embodiment 16 FIG. Embodiment 1 of the present invention
Reference numeral 6 relates to the operation timing of the application program and the garbage collection process. The basic configuration is the same as that of the third embodiment, and the description is omitted.

【0232】図29は、本実施の形態16の動作を示す
フローチャートである。本実施の形態16におけるガベ
ージコレクション処理(GC処理)S301は、実施の
形態9と同様に一定の周期で定期的に起動され動作する
ものである。本実施の形態16では、応用プログラムが
そのプログラム中で明示的にガベージコレクション処理
の実行を指示すると(S300)、応用プログラムの処
理の延長上でガベージコレクション処理を行わずに、単
に定期的に実行されるガベージコレクション処理S30
1の終了を待ち合わせ(S3001)、ガベージコレク
ション処理S301の処理が行われ待ち合わせが解除さ
れると、その処理を終了する。一方、ガベージコレクシ
ョン処理S301は、周期的に起動すると、まず「ご
み」の回収再利用のため処理S302として、例えば第
5の従来例に示したストップ−コピー方式のガベージコ
レクション処理であったり、あるいは実施の形態9に示
したようなより高度なガベージコレクション処理を実行
し、ついで処理S302の終了を待っている1ないし複
数の応用プログラムに対し、その待ち合わせを解除する
(S3011)。
FIG. 29 is a flowchart showing the operation of the sixteenth embodiment. The garbage collection process (GC process) S301 according to the sixteenth embodiment is started and operated periodically at a constant cycle, similarly to the ninth embodiment. In the sixteenth embodiment, when an application program explicitly instructs execution of garbage collection processing in the program (S300), the garbage collection processing is not performed as an extension of the processing of the application program, but is simply executed periodically. Garbage collection processing S30
1 is waited for (S3001), and when the garbage collection process S301 is performed and the wait is released, the process is terminated. On the other hand, when the garbage collection process S301 is started periodically, first, as a process S302 for collection and reuse of “garbage”, for example, a garbage collection process of the stop-copy method shown in the fifth conventional example, or A more advanced garbage collection process as described in the ninth embodiment is executed, and then the waiting is canceled for one or a plurality of application programs waiting for the end of the process S302 (S3011).

【0233】次に、本実施の形態16の動作について図
30を用いて説明する。図30は、本実施の形態16の
動作を示す解説図であり、本実施の形態16では、実施
の形態9と同様に、一定の周期で応用プログラムおよび
ガベージコレクション処理(GC処理)S301が時間
間隔T1で定期的に動作している。また、本実施の形態
16では、応用プログラムはA、B、Cの3種類が存在
し、それらの処理優先度はA>B>Cの順であるため、
同じタイミングで起動されているが基本的にはA、B、
Cの順でその動作が始まり、またAが動作している間は
B及びCは動作できず、Bが動作している間はCが動作
できないよう制御される。ガベージコレクション処理S
301は、A、B、Cのいずれの応用プログラムよりも
処理優先度が低いため、原則としてA、B、Cのいずれ
かの応用プログラムが動作している間は動作できないよ
う制御される。
Next, the operation of the sixteenth embodiment will be described with reference to FIG. FIG. 30 is an explanatory diagram showing the operation of the sixteenth embodiment. In the sixteenth embodiment, similarly to the ninth embodiment, the application program and the garbage collection process (GC process) S301 are performed at regular intervals. It operates periodically at the interval T1. In the sixteenth embodiment, there are three types of application programs A, B, and C, and their processing priorities are in the order of A>B> C.
It is started at the same timing, but basically A, B,
The operation starts in the order of C, and B and C cannot operate while A is operating, and C is not operated while B is operating. Garbage collection processing S
Since the processing priority of the application program 301 is lower than that of any of the application programs A, B, and C, the operation of the application program 301 is controlled so that the application program 301 cannot operate while the application program A, B, or C is operating.

【0234】時刻t1は応用プログラムA、B、C及び
ガベージコレクション処理S301の起動契機であり、
処理優先度に従い、まず応用プログラムAが時刻t1〜
t2の間動作し、ついで応用プログラムAの動作終了
後、応用プログラムBが時刻t2から動作を開始する。
しかし、応用プログラムBは時刻t3の時点で、そのプ
ログラムの処理の一部として明示的にガベージコレクシ
ョン処理の実行を指示する(S300)と、ガベージコ
レクション処理S301の終了の待ち合わせに入り(S
3001)、応用プログラムCが実行可能となりその実
行が始まる。応用プログラムCは時刻t4の時点でその
処理を終了し、その後ガベージコレクション処理S30
1の処理に移り、時刻t5の時点でガベージコレクショ
ン処理S301が終了すると、手順S3011により停
止していた応用プログラムBの待ち合わせが解除され、
応用プログラムBはその処理を再開、時刻t6の時点で
その処理を終了する。
Time t1 is a trigger for starting the application programs A, B, C and the garbage collection process S301.
According to the processing priority, first, the application program A starts at time t1.
It operates during t2, and after the operation of application program A ends, application program B starts operation at time t2.
However, when the application program B explicitly instructs the execution of the garbage collection process as a part of the process of the program at the time t3 (S300), the application program B waits for the end of the garbage collection process S301 (S300).
3001), the application program C becomes executable and its execution starts. The application program C ends the processing at time t4, and then performs the garbage collection processing S30
When the garbage collection process S301 ends at the time t5, the queuing of the application program B stopped in step S3011 is released.
The application program B resumes the processing, and ends the processing at time t6.

【0235】本実施の形態16は上記のように、周期的
にガベージコレクション処理が動作する計算機システム
において、処理優先度の高い応用プログラムが明示的に
ガベージコレクション処理の実行を指示した場合に、そ
の処理優先度の延長上でガベージコレクション処理を進
めること無く、他の応用プログラムの動作を優先して行
うよう動作するので、応用プログラムの動作の応答性が
向上する。
According to the sixteenth embodiment, as described above, in a computer system in which garbage collection processing operates periodically, when an application program with a high processing priority explicitly instructs execution of garbage collection processing, Since the operation is performed so as to give priority to the operation of another application program without advancing the garbage collection processing on extension of the processing priority, the responsiveness of the operation of the application program is improved.

【0236】実施の形態17.この発明の実施の形態1
7は、応用プログラムとガベージコレクション処理の動
作タイミングに関するものである。その基本構成は実施
の形態3の構成と同一であるので説明を省略する。
Embodiment 17 FIG. Embodiment 1 of the present invention
7 relates to the operation timing of the application program and the garbage collection process. The basic configuration is the same as that of the third embodiment, and the description is omitted.

【0237】図31は、本実施の形態17の動作を示す
フローチャートである。本実施の形態17におけるガベ
ージコレクション処理(GC処理)S301は、実施の
形態16のガベージコレクション処理と同一であり、実
施の形態9と同様に一定の周期で定期的に起動され動作
するものである。本実施の形態17では、応用プログラ
ムがそのプログラム中でオブジェクト領域10を獲得し
ようとすると(S310)、まず残利用可能領域13か
ら必要なオブジェクト領域10を確保できるか検査し
(S3101)、もし確保可能であれば(S3101の
Yes)、速やかにメモリ獲得手段3を用いてオブジェ
クト領域10を確保し(S3102)処理を終えるが、
一方もし確保できなければ(S3101のNo)、応用
プログラムの処理の延長上でガベージコレクション処理
を行わずに、定期的に実行されるガベージコレクション
処理S301の終了を待ち合わせ(S3001)、ガベ
ージコレクション処理S301の処理が行われ待ち合わ
せが解除されると、再度必要なオブジェクト領域10が
確保できるかの検査(S3101)に戻り、必要なオブ
ジェクト領域10が確保できるまで手順S3101、S
3001を繰り返す。一方、ガベージコレクション処理
S301は、実施の形態16における動作と同一であ
り、周期的に起動すると、まず「ごみ」の回収再利用の
ため処理S302として、例えば第5の従来例に示した
ストップ−コピー方式のガベージコレクション処理であ
ったり、あるいは実施の形態9に示したようなより高度
なガベージコレクション処理を実行し、ついで処理S3
02の終了を待っている1ないし複数の応用プログラム
に対し、その待ち合わせを解除する(S3011)。
FIG. 31 is a flowchart showing the operation of the seventeenth embodiment. The garbage collection process (GC process) S301 according to the seventeenth embodiment is the same as the garbage collection process according to the sixteenth embodiment, and is started and operated periodically at a constant cycle, similarly to the ninth embodiment. . In the seventeenth embodiment, when the application program tries to acquire the object area 10 in the program (S310), first, it is checked whether the required object area 10 can be secured from the remaining available area 13 (S3101). If it is possible (Yes in S3101), the object area 10 is promptly secured by using the memory acquisition means 3 (S3102), and the process ends.
On the other hand, if the garbage collection processing cannot be secured (No in S3101), the garbage collection processing is not performed as an extension of the processing of the application program. Is performed and the waiting is released, the process returns to the inspection (S3101) to determine whether the necessary object area 10 can be secured again, and the steps S3101 and S3 continue until the required object area 10 can be secured.
Repeat 3001. On the other hand, the garbage collection process S301 is the same as the operation in the sixteenth embodiment. A garbage collection process of a copy method or a more advanced garbage collection process as described in the ninth embodiment is executed, and then the process S3
The waiting is canceled for one or more application programs waiting for the end of 02 (S3011).

【0238】次に、本実施の形態17の動作について図
32を用いて説明する。図32は、本実施の形態17の
動作を示す解説図であり、本実施の形態17では、実施
の形態16と同様、一定の周期で応用プログラムおよび
ガベージコレクション処理(GC処理)S301が時間
間隔T1で定期的に動作している。また、実施の形態1
6と同じく、応用プログラムはA、B、Cの3種類が存
在し、それらの処理優先度はA>B>Cの順であるた
め、同じタイミングで起動されているが基本的にはA、
B、Cの順でその動作が始まり、またAが動作している
間はB及びCは動作できず、Bが動作している間はCが
動作できないよう制御される。ガベージコレクション処
理S301は、A、B、Cのいずれの応用プログラムよ
りも処理優先度が低いため、原則としてA、B、Cのい
ずれかの応用プログラムが動作している間は動作できな
いよう制御される。
Next, the operation of the seventeenth embodiment will be described with reference to FIG. FIG. 32 is an explanatory view showing the operation of the seventeenth embodiment. In the seventeenth embodiment, similarly to the sixteenth embodiment, the application program and the garbage collection process (GC process) S301 are executed at regular intervals, at regular intervals. It operates periodically at T1. Embodiment 1
6, there are three types of application programs, A, B, and C, and their processing priorities are in the order of A>B> C.
The operation is started in the order of B and C, and B and C cannot operate while A is operating, and C is not operated while B is operating. Since the garbage collection process S301 has a lower processing priority than any of the application programs A, B, and C, the garbage collection process S301 is controlled so as not to operate while any of the application programs A, B, and C is operating. You.

【0239】時刻t1は応用プログラムA、B、C及び
ガベージコレクション処理S301の起動契機であり、
処理優先度に従い、まず応用プログラムAが時刻t1〜
t2の間動作し、ついで応用プログラムAの動作終了
後、応用プログラムBが時刻t2から動作を開始する。
しかし、応用プログラムBは時刻t3の時点で、そのプ
ログラムの処理としてオブジェクト領域10の獲得S3
10を行おうと、残利用可能領域13の不足(S310
1のNo)からガベージコレクション処理S301の終
了の待ち合わせに入り(S3001)、応用プログラム
Cが実行可能となりその実行が始まる。さらに、応用プ
ログラムCも時刻t4の時点で、そのプログラムの処理
としてオブジェクト領域10の獲得S310を行おう
と、残利用可能領域13の不足(S3101のNo)か
らガベージコレクション処理S301の終了の待ち合わ
せに入る(S3001)ため、その後ガベージコレクシ
ョン処理S301の処理に移り、時刻t5の時点でガベ
ージコレクション処理S301の処理が終了すると、手
順S3011により停止していた応用プログラムB及び
応用プログラムCの待ち合わせが解除され、応用プログ
ラムB、Cは共にその処理を再開するが、応用プログラ
ムBのほうが処理優先度が高いため、まず応用プログラ
ムBが動作し時刻t6の時点でその処理を終了、続いて
応用プログラムCが動作し時刻t7の時点でその処理を
終了する。
The time t1 is a trigger for starting the application programs A, B, and C and the garbage collection processing S301.
According to the processing priority, first, the application program A starts at time t1.
It operates during t2, and after the operation of application program A ends, application program B starts operation at time t2.
However, at the time t3, the application program B obtains the object area 10 as the processing of the program at step S3.
10 and the remaining available area 13 is insufficient (S310).
From No. 1), the process waits for the end of the garbage collection process S301 (S3001), and the application program C becomes executable and its execution starts. Further, at time t4, the application program C also waits for the end of the garbage collection processing S301 due to the shortage of the remaining available area 13 (No in S3101), when the acquisition S310 of the object area 10 is performed as the processing of the program at the time t4. (S3001) Therefore, the process proceeds to the garbage collection process S301, and when the process of the garbage collection process S301 ends at the time t5, the waiting of the application programs B and C stopped in the step S3011 is released. Both the application programs B and C resume their processing. However, since the application program B has a higher processing priority, the application program B operates first, ends the processing at time t6, and then the application program C operates. The process ends at time t7 That.

【0240】本実施の形態17は上記のように、周期的
にガベージコレクション処理が動作する計算機システム
において、残利用可能領域13の不足から応用プログラ
ムの動作がガベージコレクション処理の実行を待つ必要
がある場合に、その処理優先度の延長上でガベージコレ
クション処理を進めること無く、他の応用プログラムの
動作を優先して行うよう動作するので、応用プログラム
の動作の応答性が向上し、またガベージコレクション処
理は一括して動作するのでその処理効率を高めることが
できる。
In the seventeenth embodiment, as described above, in a computer system in which garbage collection processing operates periodically, the operation of the application program needs to wait for the execution of the garbage collection processing due to the shortage of the remaining available area 13. In such a case, the operation of another application program is performed with priority, without performing the garbage collection process on the extension of the processing priority, so that the responsiveness of the operation of the application program is improved, and the garbage collection process is also performed. Operate collectively, so that the processing efficiency can be improved.

【0241】実施の形態18.この発明の実施の形態1
8は、応用プログラムとガベージコレクション処理の動
作タイミングに関するものである。その基本構成は実施
の形態3の構成と同一であるので説明を省略する。
Embodiment 18 FIG. Embodiment 1 of the present invention
8 relates to the operation timing of the application program and the garbage collection process. The basic configuration is the same as that of the third embodiment, and the description is omitted.

【0242】図33は、本実施の形態18の動作を示す
フローチャートである。本実施の形態18におけるガベ
ージコレクション処理(GC処理)S321は、実施の
形態9と同様に一定の周期で定期的に起動され動作する
ものである。本実施の形態18では、応用プログラムが
そのプログラム中でオブジェクト領域10を獲得しよう
とした場合は(S320)、まず残利用可能領域13か
ら必要なオブジェクト領域10を確保できるか検査し
(S3101)、もし確保可能であれば(S3101の
Yes)、速やかにメモリ獲得手段3を用いてオブジェ
クト領域10を確保し(S3102)処理を終えるが、
一方もし確保できなければ(S3101のNo)、応用
プログラムの処理の延長上でガベージコレクション処理
を行わずに、GC処理待ちリスト19へ自プログラムが
必要とするオブジェクト領域10の要求量と、他プログ
ラムから自プログラムを区別するための、例えばプロセ
スIDなどの識別子を合わせ追加登録し(S320
1)、その後定期的に実行されるガベージコレクション
処理S301からの待ち合わせ解除を待ち(S320
2)、待ち合わせが解除されると、再度必要なオブジェ
クト領域10が確保できるかの検査(S3101)に戻
り、必要なオブジェクト領域10が確保できるまで手順
S3101、S3201、S3202を繰り返す。ま
た、応用プログラムがそのプログラム中で明示的にガベ
ージコレクション処理の実行を指示した場合は(S30
0)、実施の形態16と同じく、応用プログラムの処理
の延長上でガベージコレクション処理を行わずに、単に
定期的に実行されるガベージコレクション処理S301
の終了を待ち合わせ(S3001)、ガベージコレクシ
ョン処理S301の処理が行われ待ち合わせが解除され
ると、その処理を終了する。
FIG. 33 is a flow chart showing the operation of the eighteenth embodiment. The garbage collection process (GC process) S321 according to the eighteenth embodiment is started and operated periodically at a constant cycle, similarly to the ninth embodiment. In the eighteenth embodiment, when the application program attempts to acquire the object area 10 in the program (S320), it is checked whether the required object area 10 can be secured from the remaining available area 13 (S3101). If the object area 10 can be secured (Yes in S3101), the object area 10 is quickly secured using the memory acquisition means 3 (S3102), and the process ends.
On the other hand, if it cannot be secured (No in S3101), the garbage collection processing is not performed as an extension of the processing of the application program, and the request amount of the object area 10 required by the own program and the other program And an additional register, such as a process ID, for distinguishing the program from the own program (S320).
1) Waiting for the release of the wait from the garbage collection process S301 which is periodically executed thereafter (S320)
2) When the queuing is released, the process returns to the inspection (S3101) for determining whether the necessary object area 10 can be secured again, and repeats the steps S3101, S3201, and S3202 until the required object area 10 can be secured. When the application program explicitly instructs the execution of the garbage collection process in the program (S30)
0), as in the sixteenth embodiment, a garbage collection process S301 that is simply performed periodically without performing a garbage collection process on the extension of the processing of the application program.
(S3001), and when the garbage collection process S301 is performed and the waiting is released, the process is terminated.

【0243】一方、ガベージコレクション処理(GC処
理)S321は、実施の形態9に示しされるガベージコ
レクション処理S200と同様に、大きく次の3つの段
階、事前処理S201、繰り返される単位処理S20
2、事後処理S203から構成され、周期的な起動毎
に、まずガベージコレクション処理のうち繰り返し処理
S202に入る前の準備として事前処理S201を行
い、ついでガベージコレクション処理の繰り返し処理S
202を1単位処理分だけ実行する。その後は、GC処
理待ちリスト19の登録内容を検査し(S3211)
し、現在の残利用可能領域13の量で、必要とするオブ
ジェクト領域10が確保可能な応用プログラムがいるか
調べ(S3212のYes)、もし存在すれば(S23
12のYes)、GC処理待ちリスト17に登録されて
いるプログラムの識別子を元に該当する応用プログラム
の待ち合わせを解除し(S3213)、GC処理待ちリ
スト17から該当エントリを削除する(S3214)。
なお、現在の残利用可能領域13の量では必要とするオ
ブジェクト領域10が確保可能な応用プログラムがいな
ければ(S3213のNo)、手順S3213及び手順
S3214は行わない。ついで、さらに繰り返し処理S
202を継続する必要があれば(S2002のNo)、
上記手順S202〜S2002を繰り返し行い、繰り返
し処理S202を行う必要が無くなれば(S2002の
Yes)、ガベージコレクション処理の後始末として事
後処理S203を行い、その後ガベージコレクション処
理S321の終了を待っている1ないし複数の応用プロ
グラムに対し、その待ち合わせを解除し(S3011)
処理を終了する。
On the other hand, the garbage collection processing (GC processing) S321 is substantially the same as the garbage collection processing S200 shown in the ninth embodiment, and is roughly divided into the following three stages, preprocessing S201, and repeated unit processing S20.
2. Post-processing S203 is performed, and every time the apparatus is started periodically, first, a pre-processing S201 is performed as a preparation before entering the repetition processing S202 in the garbage collection processing, and then a repetition processing S of the garbage collection processing is performed.
202 is executed for one unit process. Thereafter, the registered contents of the GC processing waiting list 19 are checked (S3211).
Then, it is checked whether there is an application program that can secure the required object area 10 based on the current amount of the remaining available area 13 (Yes in S3212).
In step S3213, the corresponding application program is released from queuing based on the identifier of the program registered in the GC processing waiting list 17 (S3213), and the corresponding entry is deleted from the GC processing waiting list 17 (S3214).
If there is no application program that can secure the required object area 10 with the current amount of the remaining available area 13 (No in S3213), the procedures S3213 and S3214 are not performed. Then, further repetition processing S
If it is necessary to continue 202 (No in S2002),
The above steps S202 to S2002 are repeated, and when it is no longer necessary to perform the repetition process S202 (Yes in S2002), the post-process S203 is performed as the end of the garbage collection process, and thereafter 1 to Cancel the waiting for a plurality of application programs (S3011)
The process ends.

【0244】手順S201、S202、S203の詳細
は、実施の形態9に等しいので説明を省略する。ただ
し、本実施の形態18では、手順S202に示す処理
は、実施の形態9と異なり、常に必要な回数繰り返され
るため、繰り返しを途中で止めた場合に不整合が発生す
るような処理であってもかまわず、利用できるガベージ
コレクション方式の選択肢は、実施の形態9より広が
る。
The details of steps S201, S202, and S203 are the same as those in the ninth embodiment, and will not be described. However, in the eighteenth embodiment, unlike the ninth embodiment, the processing shown in step S202 is always repeated a necessary number of times, and therefore, when the repetition is stopped halfway, inconsistency occurs. Regardless, available garbage collection options are wider than in the ninth embodiment.

【0245】次に、本実施の形態18の動作について図
34を用いて説明する。図34は、本実施の形態18の
動作を示す解説図であり、本実施の形態18では、実施
の形態16と同様、一定の周期で応用プログラムおよび
ガベージコレクション処理(GC処理)S321が時間
間隔T1で定期的に動作している。また、実施の形態1
6と同じく、応用プログラムはA、B、Cの3種類が存
在し、それらの処理優先度はA>B>Cの順であるた
め、同じタイミングで起動されているが基本的にはA、
B、Cの順でその動作が始まり、またAが動作している
間はB及びCは動作できず、Bが動作している間はCが
動作できないよう制御される。ガベージコレクション処
理S321は、A、B、Cのいずれの応用プログラムよ
りも処理優先度が低いため、原則としてA、B、Cのい
ずれかの応用プログラムが動作している間は動作できな
いよう制御される。
Next, the operation of the eighteenth embodiment will be described with reference to FIG. FIG. 34 is an explanatory diagram showing the operation of the eighteenth embodiment. In the eighteenth embodiment, similarly to the sixteenth embodiment, the application program and the garbage collection process (GC process) S321 are executed at regular intervals. It operates periodically at T1. Embodiment 1
6, there are three types of application programs, A, B, and C, and their processing priorities are in the order of A>B> C.
The operation is started in the order of B and C, and B and C cannot operate while A is operating, and C is not operated while B is operating. Since the garbage collection process S321 has a lower processing priority than any of the application programs A, B, and C, the garbage collection process S321 is controlled such that it cannot operate while any of the application programs A, B, and C is operating. You.

【0246】時刻t1は応用プログラムA、B、C及び
ガベージコレクション処理S321の起動契機であり、
処理優先度に従い、まず応用プログラムAが時刻t1〜
t2の間動作し、ついで応用プログラムAの動作終了
後、応用プログラムBが時刻t2から動作を開始する。
しかし、応用プログラムBは時刻t3の時点で、そのプ
ログラムの処理の一部として明示的にガベージコレクシ
ョン処理の実行を指示する(S300)と、ガベージコ
レクション処理S301の終了の待ち合わせに入り(S
3001)、その結果、応用プログラムCが実行可能と
なりその実行が始まる。応用プログラムCは時刻t4の
時点で、そのプログラムの処理としてオブジェクト領域
10の獲得S320を行おうとすると、残利用可能領域
13の不足(S3101のNo)から、GC処理待ちリ
スト19へ自プログラムの必要量と識別子を登録(S3
201)したのち、ガベージコレクション処理S301
から待ち合わせ解除の待ちに入り(S3202)、その
後ガベージコレクション処理S321の処理に移る。
Time t1 is a trigger for starting the application programs A, B, C and the garbage collection process S321.
According to the processing priority, first, the application program A starts at time t1.
It operates during t2, and after the operation of application program A ends, application program B starts operation at time t2.
However, when the application program B explicitly instructs the execution of the garbage collection process as a part of the process of the program at the time t3 (S300), the application program B waits for the end of the garbage collection process S301 (S300).
3001) As a result, the application program C becomes executable and its execution starts. When the application program C tries to acquire the object area 10 as processing of the program at the time t4, the application program C needs to be placed in the GC processing waiting list 19 due to the shortage of the remaining available area 13 (No in S3101). Register the quantity and identifier (S3
201), and then garbage collection processing S301
Then, the process enters a waiting state for waiting (S3202), and then proceeds to a garbage collection process S321.

【0247】ガベージコレクション処理S321では、
数回手順S202を繰り返すと、応用プログラムCが必
要とするオブジェクト領域10が獲得できるまで残利用
可能領域13が増えたので、GC処理待ちリスト19に
登録されている情報を元に、応用プログラムCの待ちを
時刻t5の時点で解除する(S3213)。その結果、
手順S3202により停止していた応用プログラムCの
待ち合わせが解除され、応用プログラムCはその処理を
再開、時刻t6の時点でその処理を終了する。その後は
再度ガベージコレクション処理がS321、応用プログ
ラムCの動作により時刻t5の時点で停止していた処理
を再開、時刻t7の時点でガベージコレクション処理S
321が終了すると、手順3011により停止していた
応用プログラムBの待ち合わせが解除され、応用プログ
ラムBはその処理を再開、時刻t8の時点でその処理を
終了する。
In the garbage collection process S321,
When the procedure S202 is repeated several times, the remaining available area 13 increases until the object area 10 required by the application program C can be obtained. Is released at time t5 (S3213). as a result,
In step S3202, the queuing of the application program C which has been stopped is released, and the application program C resumes its processing, and ends the processing at time t6. Thereafter, the garbage collection process is restarted in S321, and the process that was stopped at the time t5 by the operation of the application program C is restarted. At the time t7, the garbage collection process S
When 321 ends, the queuing of the application program B that has been stopped in step 3011 is released, the application program B resumes its processing, and ends the processing at time t8.

【0248】本実施の形態18は上記のように、周期的
にガベージコレクション処理が動作する計算機システム
において、応用プログラムの動作がガベージコレクショ
ン処理の実行を待つ必要がある場合に、その処理優先度
の延長上でガベージコレクション処理を進めること無
く、他の応用プログラムの動作を優先して行うよう動作
し、さらに残利用可能領域13の不足からガベージコレ
クション処理の実行を待つ必要のある応用プログラム
と、明示的にガベージコレクション処理の実行を指示し
た応用プログラムとでは前者の動作を優先するよう動作
すし、そのうえ、残利用可能領域13の不足からガベー
ジコレクション処理の実行を待つ必要のある複数の応用
プログラムの間では、必要量が少ない応用プログラムの
動作を優先するよう動作するので、応用プログラムの動
作の応答性が向上する。
According to the eighteenth embodiment, as described above, in a computer system in which garbage collection processing operates periodically, when the operation of an application program needs to wait for the execution of garbage collection processing, the processing priority is An application program that operates so as to give priority to the operation of another application program without advancing the garbage collection process on the extension and that needs to wait for the execution of the garbage collection process due to a shortage of the remaining available area 13. The application program that instructs the execution of the garbage collection process operates so that the former operation takes precedence, and furthermore, a plurality of application programs that need to wait for the execution of the garbage collection process due to the lack of the remaining available area 13. Now, the priority is given to the operation of application programs that require less Because, to improve the responsiveness of the operation of the application program.

【0249】なお、本実施の形態18では、手順S32
13、手順S3214にて、該当する応用プログラムの
1つについてのみ待ち合わせを解除するようにしたが、
これは該当する複数の応用プログラムに対して待ち合わ
せを解除するようにしてもよく、この場合待ち合わせを
解除された応用プログラムは、その処理優先度の高いも
のから順に可能な限りオブジェクト領域10を獲得する
ように動作するので、応用プログラムの動作の応答性は
さらに向上する。
In the eighteenth embodiment, step S32
13. In step S3214, the waiting is canceled only for one of the applicable application programs.
In this case, the queuing may be released for a plurality of application programs. In this case, the application programs whose queuing has been released acquire the object area 10 as much as possible in the order of the processing priority. Thus, the responsiveness of the operation of the application program is further improved.

【0250】また、本実施の形態18に示すガベージコ
レクション処理に対し、実施の形態9あるいは実施の形
態10を組み合わせ、その実行時間の制限を持たせた
り、また実施の形態3で述べたように、獲得した残利用
可能領域がある閾値を超えたところで処理を中断するよ
う変更してもよく、それぞれの実施の形態の効果を得る
ことができる。ただし、このような変更を行った場合
は、手順S202に示す処理は必要な回数に満たない回
数しか繰り返されない場合が有り得るようになるので、
手順S202の繰り返しを途中で止めた場合でも不整合
が発生しないよう、実施の形態3、実施の形態9あるい
は実施の形態10に示したようなガベージコレクション
方式を採用する必要がある。
In addition, the garbage collection processing shown in the eighteenth embodiment is combined with the ninth or tenth embodiment to limit the execution time, and as described in the third embodiment. The processing may be changed so that the processing is interrupted when the acquired remaining available area exceeds a certain threshold, and the effects of the respective embodiments can be obtained. However, if such a change is made, the process shown in step S202 may be repeated only less than the required number of times.
It is necessary to adopt a garbage collection method as described in the third, ninth or tenth embodiment so that inconsistency does not occur even when the repetition of step S202 is stopped halfway.

【0251】[0251]

【発明の効果】以上のように、この発明の請求項1によ
れば、参照カウンタ方式と他の方式を併用したガベージ
コレクション手段を備えた動的メモリ管理機構におい
て、ポインタの値の変更の動作を予測可能とし、かつそ
の実装を簡素にできるという効果がある。
As described above, according to the first aspect of the present invention, in the dynamic memory management mechanism having the garbage collection means using both the reference counter method and another method, the operation of changing the value of the pointer is performed. Is predictable and its implementation can be simplified.

【0252】また、この発明の請求項2によれば、請求
項1の効果に加え、請求項1による動的メモリ管理機構
より、ガベージコレクション処理の効率を高められると
いう効果がある。
Further, according to the second aspect of the present invention, in addition to the effect of the first aspect, there is an effect that the efficiency of the garbage collection process can be enhanced by the dynamic memory management mechanism according to the first aspect.

【0253】この発明の請求項3によれば、ガベージコ
レクション手段を備えた動的メモリ管理機構において、
メモリリーク現象やフラグメンテーション現象が発生せ
ず、かつメモリ利用効率を高められるという効果があ
る。
According to a third aspect of the present invention, in the dynamic memory management mechanism having garbage collection means,
There is an effect that the memory leak phenomenon and the fragmentation phenomenon do not occur and the memory use efficiency can be improved.

【0254】この発明の請求項4によれば、請求項3の
効果に加え、ガベージコレクション処理全体の処理時間
を短縮できるという効果がある。
According to claim 4 of the present invention, in addition to the effect of claim 3, there is an effect that the processing time of the entire garbage collection process can be shortened.

【0255】この発明の請求項5によれば、請求項3の
効果に加え、ガベージコレクション処理全体の処理時間
を短縮できるという効果がある。
According to the fifth aspect of the present invention, in addition to the effect of the third aspect, there is an effect that the processing time of the entire garbage collection process can be reduced.

【0256】この発明の請求項6によれば、請求項3の
効果に加え、ガベージコレクション処理の効率を向上で
きるという効果がある。
According to claim 6 of the present invention, in addition to the effect of claim 3, there is an effect that the efficiency of the garbage collection process can be improved.

【0257】この発明の請求項7によれば、請求項3の
効果に加え、ガベージコレクション処理の効率を向上で
き、さらにガベージコレクション処理の動作を簡素にで
きるというという効果がある。
According to the seventh aspect of the present invention, in addition to the effect of the third aspect, the efficiency of the garbage collection process can be improved, and the operation of the garbage collection process can be simplified.

【0258】この発明の請求項8によれば、請求項3の
効果に加え、ガベージコレクション処理の効率を向上で
きるという効果がある。
According to the eighth aspect of the present invention, in addition to the effect of the third aspect, there is an effect that the efficiency of the garbage collection process can be improved.

【0259】この発明の請求項9によれば、オブジェク
ト領域のコピーを伴う方式のガベージコレクション手段
を備えた動的メモリ管理機構において、その処理を簡素
にすることができ、さらにガベージコレクション処理の
速度が高まるという効果がある。
According to the ninth aspect of the present invention, in a dynamic memory management mechanism having a garbage collection means of a type involving copying of an object area, the processing can be simplified, and the speed of the garbage collection processing can be further reduced. There is an effect that is increased.

【0260】この発明の請求項10によれば、定期的に
動作するガベージコレクション手段を備えた動的メモリ
管理機構において、応用プログラムの周期的動作の阻害
せず、計算機システムの定応答性を向上できるという効
果がある。
According to the tenth aspect of the present invention, in the dynamic memory management mechanism having the garbage collection means that operates periodically, the constant response of the computer system is improved without hindering the periodic operation of the application program. There is an effect that can be.

【0261】この発明の請求項11によれば、請求項1
0の効果に加え、計算機システムの動作を安定にすると
いう効果がある。
According to claim 11 of the present invention, claim 1
In addition to the effect of 0, there is an effect of stabilizing the operation of the computer system.

【0262】この発明の請求項12によれば、請求項1
0の効果に加え、メモリ利用効率が向上するという効果
がある。
According to claim 12 of the present invention, claim 1
In addition to the effect of 0, there is an effect that the memory use efficiency is improved.

【0263】この発明の請求項13によれば、請求項1
2の効果に加え、より応用プログラムの動作および計算
機システム全体の動作が安定するという効果がある。
According to claim 13 of the present invention, claim 1
In addition to the effect of 2, there is an effect that the operation of the application program and the operation of the entire computer system become more stable.

【0264】この発明の請求項14によれば、ガベージ
コレクション手段を備えた動的メモリ管理機構におい
て、計算機システムの性能が向上するという効果があ
る。
According to the fourteenth aspect of the present invention, in the dynamic memory management mechanism having the garbage collection means, there is an effect that the performance of the computer system is improved.

【0265】この発明の請求項15によれば、ガベージ
コレクション手段を備えた動的メモリ管理機構におい
て、応用プログラムの動作の応答性を向上させるという
効果がある。
According to the fifteenth aspect of the present invention, in the dynamic memory management mechanism having the garbage collection means, there is an effect that the responsiveness of the operation of the application program is improved.

【0266】この発明の請求項16によれば、ガベージ
コレクション手段を備えた動的メモリ管理機構におい
て、計算機システムの動作を安定させるという効果があ
る。
According to the sixteenth aspect of the present invention, in the dynamic memory management mechanism having the garbage collection means, there is an effect that the operation of the computer system is stabilized.

【0267】この発明の請求項17によれば、ガベージ
コレクション手段を備えた動的メモリ管理機構におい
て、計算機システムの立ち上げ段階では立ち上げ処理時
間が短くなり、計算機システムの定常段階では応用プロ
グラムの動作の応答性が向上するという効果がある。
According to the seventeenth aspect of the present invention, in the dynamic memory management mechanism having the garbage collection means, the startup processing time is shortened at the startup stage of the computer system, and the startup time of the application program is reduced at the steady stage of the computer system. This has the effect of improving the responsiveness of the operation.

【0268】この発明の請求項18によれば、定期的に
動作するガベージコレクション手段を備えた動的メモリ
管理機構において、応用プログラムの動作の応答性が向
上するという効果がある。
According to the eighteenth aspect of the present invention, in the dynamic memory management mechanism having the garbage collection means which operates periodically, there is an effect that the responsiveness of the operation of the application program is improved.

【0269】この発明の請求項19によれば、定期的に
動作するガベージコレクション手段を備えた動的メモリ
管理機構において、応用プログラムの動作の応答性が向
上するという効果がある。
According to the nineteenth aspect of the present invention, in the dynamic memory management mechanism having garbage collection means that operates periodically, there is an effect that the responsiveness of the operation of the application program is improved.

【0270】この発明の請求項20によれば、請求項1
8の効果に加え、ガベージコレクション処理の効率を高
められるという効果がある。
According to claim 20 of the present invention, claim 1
In addition to the effect of No. 8, there is an effect that the efficiency of the garbage collection process can be enhanced.

【0271】この発明の請求項21によれば、定期的に
動作するガベージコレクション手段を備えた動的メモリ
管理機構において、応用プログラムの動作の応答性が向
上するという効果がある。
According to the twenty-first aspect of the present invention, in the dynamic memory management mechanism having the garbage collection means which operates periodically, there is an effect that the responsiveness of the operation of the application program is improved.

【図面の簡単な説明】[Brief description of the drawings]

【図1】 この発明の実施の形態1に係る動的メモリ管
理機構の構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of a dynamic memory management mechanism according to Embodiment 1 of the present invention.

【図2】 この発明の実施の形態1に係る動的メモリ管
理機構の動作を示すフローチャートである。
FIG. 2 is a flowchart showing an operation of the dynamic memory management mechanism according to the first embodiment of the present invention.

【図3】 この発明の実施の形態1における動作実施前
を示す解説図である。
FIG. 3 is an explanatory diagram showing a state before the operation is performed in the first embodiment of the present invention.

【図4】 この発明の実施の形態1における動作実施後
を示す解説図である。
FIG. 4 is an explanatory diagram showing a state after the operation is performed in the first embodiment of the present invention.

【図5】 この発明の実施の形態2に係る動的メモリ管
理機構の動作を示すフローチャートである。
FIG. 5 is a flowchart showing an operation of a dynamic memory management mechanism according to Embodiment 2 of the present invention.

【図6】 この発明の実施の形態2における動作実施後
を示す解説図である。
FIG. 6 is an explanatory diagram showing a state after execution of an operation according to the second embodiment of the present invention.

【図7】 この発明の実施の形態3に係る動的メモリ管
理機構の構成を示すブロック図である。
FIG. 7 is a block diagram showing a configuration of a dynamic memory management mechanism according to Embodiment 3 of the present invention.

【図8】 この発明の実施の形態3に係る動的メモリ管
理機構の動作を示すフローチャートである。
FIG. 8 is a flowchart showing an operation of a dynamic memory management mechanism according to Embodiment 3 of the present invention.

【図9】 この発明の実施の形態3における動作を示す
解説図である。
FIG. 9 is an explanatory diagram showing an operation in the third embodiment of the present invention.

【図10】 この発明の実施の形態4の動作を示すフロ
ーチャートである。
FIG. 10 is a flowchart showing the operation of the fourth embodiment of the present invention.

【図11】 この発明の実施の形態5における動作を示
す解説図である。
FIG. 11 is an explanatory diagram showing an operation in the fifth embodiment of the present invention.

【図12】 この発明の実施の形態6における動作を示
す解説図である。
FIG. 12 is an explanatory diagram showing an operation according to the sixth embodiment of the present invention.

【図13】 この発明の実施の形態7の動作を示す全体
のフローチャートである。
FIG. 13 is an overall flowchart showing the operation of the seventh embodiment of the present invention.

【図14】 この発明の実施の形態7における部分コン
パクト処理を示すフローチャートである。
FIG. 14 is a flowchart showing a partial compact process according to the seventh embodiment of the present invention.

【図15】 この発明の実施の形態7における動作を示
す解説図である。
FIG. 15 is an explanatory diagram showing an operation according to the seventh embodiment of the present invention.

【図16】 この発明の実施の形態8を示す構成図であ
る。
FIG. 16 is a configuration diagram showing an eighth embodiment of the present invention.

【図17】 この発明の実施の形態9の動作を示すフロ
ーチャートである。
FIG. 17 is a flowchart showing the operation of the ninth embodiment of the present invention.

【図18】 この発明の実施の形態9における動作を示
す解説図である。
FIG. 18 is an explanatory diagram showing an operation in Embodiment 9 of the present invention.

【図19】 この発明の実施の形態10の動作を示すフ
ローチャートである。
FIG. 19 is a flowchart showing the operation of the tenth embodiment of the present invention.

【図20】 この発明の実施の形態10における動作を
示す解説図である。
FIG. 20 is an explanatory diagram showing an operation in the tenth embodiment of the present invention.

【図21】 この発明の実施の形態11の動作を示すフ
ローチャートである。
FIG. 21 is a flowchart showing an operation of the eleventh embodiment of the present invention.

【図22】 この発明の実施の形態11における動作を
示す解説図である。
FIG. 22 is an explanatory diagram showing an operation in Embodiment 11 of the present invention.

【図23】 この発明の実施の形態12に係る動的メモ
リ管理機構の構成を示すブロック図である。
FIG. 23 is a block diagram showing a configuration of a dynamic memory management mechanism according to Embodiment 12 of the present invention.

【図24】 この発明の実施例12の動作を示す全体の
フローチャートである。
FIG. 24 is an overall flowchart showing the operation of Embodiment 12 of the present invention.

【図25】 この発明の実施例12における非コピー式
のガベージコレクション処理を示すフローチャートであ
る。
FIG. 25 is a flowchart illustrating non-copy garbage collection processing according to a twelfth embodiment of the present invention.

【図26】 この発明の実施の形態13の動作を示すフ
ローチャートである。
FIG. 26 is a flowchart showing the operation of Embodiment 13 of the present invention.

【図27】 この発明の実施の形態14の動作を示すフ
ローチャートである。
FIG. 27 is a flowchart showing an operation according to the fourteenth embodiment of the present invention.

【図28】 この発明の実施の形態15の動作を示すフ
ローチャートである。
FIG. 28 is a flowchart showing the operation of Embodiment 15 of the present invention.

【図29】 この発明の実施の形態16の動作を示すフ
ローチャートである。
FIG. 29 is a flowchart showing the operation of the sixteenth embodiment of the present invention.

【図30】 この発明の実施の形態16における動作を
示す解説図である。
FIG. 30 is an explanatory diagram showing an operation in Embodiment 16 of the present invention.

【図31】 この発明の実施の形態17の動作を示すフ
ローチャートである。
FIG. 31 is a flowchart showing an operation of the seventeenth embodiment of the present invention.

【図32】 この発明の実施の形態17における動作を
示す解説図である。
FIG. 32 is an explanatory view showing operation in Embodiment 17 of the present invention.

【図33】 この発明の実施の形態18の動作を示すフ
ローチャートである。
FIG. 33 is a flowchart showing an operation according to the eighteenth embodiment of the present invention.

【図34】 この発明の実施の形態18における動作を
示す解説図である。
FIG. 34 is an explanatory diagram showing an operation according to the eighteenth embodiment of the present invention.

【図35】 ガベージコレクション処理における「生き
ている」記憶領域と「ごみ」の区別を示す解説図であ
る。
FIG. 35 is an explanatory diagram showing a distinction between “live” storage areas and “garbage” in the garbage collection process.

【図36】 第1の従来例の動的メモリ管理機構の構成
を示すブロック図である。
FIG. 36 is a block diagram showing a configuration of a dynamic memory management mechanism of a first conventional example.

【図37】 第1の従来例におけるオブジェクト領域獲
得の動作を示すフローチャートである。
FIG. 37 is a flowchart showing an operation of acquiring an object area in the first conventional example.

【図38】 第1の従来例におけるポインタの値の変更
の動作を示すフローチャートである。
FIG. 38 is a flowchart showing an operation of changing the value of a pointer in the first conventional example.

【図39】 第1の従来例における第1の動作実施前を
示す解説図である。
FIG. 39 is an explanatory diagram showing a state before performing a first operation in a first conventional example.

【図40】 第1の従来例における第1の動作実施の中
間段階1を示す解説図である。
FIG. 40 is an explanatory diagram showing an intermediate stage 1 of performing the first operation in the first conventional example.

【図41】 第1の従来例における第1の動作実施の中
間段階2を示す解説図である。
FIG. 41 is an explanatory view showing an intermediate stage 2 of performing the first operation in the first conventional example.

【図42】 第1の従来例における第1の動作実施後を
示す解説図である。
FIG. 42 is an explanatory view showing a state after the first operation in the first conventional example.

【図43】 第1の従来例における第2の動作実施前を
示す解説図である。
FIG. 43 is an explanatory diagram showing a state before performing a second operation in the first conventional example.

【図44】 第1の従来例における第2の動作実施後を
示す解説図である。
FIG. 44 is an explanatory diagram showing a state after performing the second operation in the first conventional example.

【図45】 第2の従来例の動作を示すフローチャート
である。
FIG. 45 is a flowchart showing the operation of the second conventional example.

【図46】 第3の従来例の動的メモリ管理機構の構成
を示すブロック図である。
FIG. 46 is a block diagram showing a configuration of a dynamic memory management mechanism of a third conventional example.

【図47】 第3の従来例の動作を示すフローチャート
である。
FIG. 47 is a flowchart showing the operation of the third conventional example.

【図48】 第3の従来例における動作を示す解説図で
ある。
FIG. 48 is an explanatory diagram showing an operation in the third conventional example.

【図49】 第4の従来例の動的メモリ管理機構の構成
を示すブロック図である。
FIG. 49 is a block diagram showing a configuration of a dynamic memory management mechanism of a fourth conventional example.

【図50】 第4の従来例の動作を示すフローチャート
である。
FIG. 50 is a flowchart showing the operation of the fourth conventional example.

【図51】 第4の従来例における動作を示す解説図で
ある。
FIG. 51 is an explanatory diagram showing an operation in a fourth conventional example.

【図52】 第5の従来例の動的メモリ管理機構の構成
を示すブロック図である。
FIG. 52 is a block diagram showing a configuration of a fifth conventional dynamic memory management mechanism.

【図53】 第5の従来例の動作を示すフローチャート
である。
FIG. 53 is a flowchart showing the operation of the fifth conventional example.

【図54】 第5の従来例における動作を示す解説図で
ある。
FIG. 54 is an explanatory diagram showing an operation in the fifth conventional example.

【図55】 第6の従来例の動的メモリ管理機構の構成
を示すブロック図である。
FIG. 55 is a block diagram showing a configuration of a dynamic memory management mechanism of a sixth conventional example.

【図56】 第7の従来例の動作を示すフローチャート
である。
FIG. 56 is a flowchart showing the operation of the seventh conventional example.

【図57】 第8の従来例の動的メモリ管理機構の構成
を示すブロック図である。
FIG. 57 is a block diagram showing the configuration of an eighth conventional dynamic memory management mechanism.

【図58】 第8の従来例における第1の動作を示すフ
ローチャートである。
FIG. 58 is a flowchart showing a first operation in the eighth conventional example.

【図59】 第8の従来例における第1の動作を示す解
説図である。
FIG. 59 is an explanatory diagram showing a first operation in the eighth conventional example.

【図60】 第8の従来例における第2の動作を示すフ
ローチャートである。
FIG. 60 is a flowchart showing a second operation in the eighth conventional example.

【図61】 第8の従来例における第2の動作を示す解
説図である。
FIG. 61 is an explanatory diagram showing a second operation in the eighth conventional example.

【符号の説明】[Explanation of symbols]

1 動的メモリ管理機構、2 ヒープ領域、3 メモリ
獲得手段、4 メモリ開放手段、5 ガベージコレクシ
ョン手段、10 オブジェクト領域、11 参照カウン
タ、12 ポインタ、13 残利用可能領域、14 既
獲得済み領域、15 TO領域、16 FROM領域、
17 参照テーブル、18 フリーリスト、19 ガベ
ージコレクション(GC)処理待ちリスト、20 マー
ク、21ごみリスト、22 間接ポインタ、23 OL
D領域。
DESCRIPTION OF SYMBOLS 1 Dynamic memory management mechanism, 2 heap area, 3 memory acquisition means, 4 memory release means, 5 garbage collection means, 10 object area, 11 reference counter, 12 pointer, 13 remaining available area, 14 already acquired area, 15 TO area, 16 FROM area,
17 reference table, 18 free list, 19 garbage collection (GC) processing waiting list, 20 mark, 21 garbage list, 22 indirect pointer, 23 OL
D area.

Claims (22)

【特許請求の範囲】[Claims] 【請求項1】 ヒープ領域と、 前記ヒープ領域からその一部をオブジェクト領域として
獲得するメモリ獲得手段と、 前記獲得したオブジェクト領域を前記ヒープ領域に戻し
再利用可能とするメモリ開放手段と、 前記メモリ獲得手段により獲得されたがプログラムから
利用されなくなったオブジェクト領域を探索し、前記メ
モリ開放手段を用いて前記ヒープ領域へ開放するガベー
ジコレクション手段とを備え、 前記各オブジェクト領域にはそれぞれ、その利用状況を
示す参照カウンタが存在し、各参照カウンタは対応する
オブジェクト領域を参照するポインタの数を示すようそ
の値が増減し、 前記ガベージコレクション手段は、前記参照カウンタの
値が0となったとき対応するオブジェクト領域を開放す
る参照カウンタ方式のガベージコレクション処理と、他
の方式によるガベージコレクション処理を併用して動作
する場合に、前記参照カウンタの値が0になり対応する
第1のオブジェクト領域が開放される際に、前記第1の
オブジェクト領域のみ開放し、前記第1のオブジェクト
領域内にある1ない複数のポインタが参照している第2
のオブジェクト領域については、参照カウンタの値の更
新処理および同処理に付随して発生しうるオブジェクト
領域の開放処理を行わないことを特徴とする動的メモリ
管理機構。
1. a heap area; a memory obtaining means for obtaining a part of the heap area from the heap area as an object area; a memory releasing means for returning the obtained object area to the heap area for re-use; Garbage collection means for searching for an object area acquired by the acquisition means but no longer used by the program, and releasing the object area to the heap area by using the memory releasing means. And the value of each reference counter increases or decreases so as to indicate the number of pointers that refer to the corresponding object area. The garbage collection means responds when the value of the reference counter becomes 0. Reference counter garbage collector that frees object area When the reference processing is performed and the corresponding first object area is released when the value of the reference counter becomes 0 and the garbage collection processing by another method is operated in combination, the first object area Open only the second object referenced by one or more pointers in the first object area.
A dynamic memory management mechanism which does not perform a process of updating the value of a reference counter and a process of releasing an object area which may occur in association with the object area.
【請求項2】 前記ガベージコレクション手段は、前記
参照カウンタの値が0となって前記第1のオブジェクト
領域を開放するときに、前記第1のオブジェクトの領域
内にある1ないし複数のポインタの値を無効値に設定す
ることを特徴とする請求項1記載の動的メモリ管理機
構。
2. The method according to claim 1, wherein when the value of the reference counter becomes 0 and the first object area is released, a value of one or a plurality of pointers in the area of the first object is set. 2. The dynamic memory management mechanism according to claim 1, wherein the value is set to an invalid value.
【請求項3】 ヒープ領域と、前記ヒープ領域からその
一部をオブジェクト領域として獲得するメモリ獲得手段
と、 前記獲得したオブジェクト領域を前記ヒープ領域に戻し
再利用可能とするメモリ開放手段と、 前記メモリ獲得手段により獲得されたがプログラムから
利用されなくなったオブジェクト領域を探索し、前記メ
モリ開放手段を用いて前記ヒープ領域へ開放するガベー
ジコレクション手段とを備え、 前記メモリ獲得手段は、前記ヒープ領域内の残利用可能
領域の一端から順次オブジェクト領域を獲得し、 前記ガベージコレクション手段は、まず前記残利用可能
領域をTO領域とし、前記TO領域に隣接する同量ない
しそれ以下の既獲得済み領域をFROM領域とし、コピ
ーにより個々のオブジェクト領域を移動させる形で部分
ガベージコレクション処理を行い、次に、前記TO領域
のうちオブジェクト領域が移動しないで利用可能として
残った領域と、空になったFROM領域を合わせた新し
い残利用可能領域を新たなTO領域とし、まだガベージ
コレクション処理を行ってない既獲得済み領域のうち新
しい残利用可能領域と同量の領域を新たなFROM領域
として再度部分ガベージコレクション処理を行い、既獲
得済み領域の全体にガベージコレクション処理が及ぶま
で、以降も同様に部分ガベージコレクション処理を繰り
返すことを特徴とする動的メモリ管理機構。
3. A heap area, memory acquisition means for acquiring a part of the heap area from the heap area as an object area, memory release means for returning the acquired object area to the heap area for reuse, and the memory Garbage collection means for searching for an object area acquired by the acquisition means but no longer used by the program, and releasing the object area to the heap area by using the memory release means, wherein the memory acquisition means comprises: The object area is sequentially acquired from one end of the remaining available area, and the garbage collection means first sets the remaining available area as a TO area, and the same or less acquired area adjacent to the TO area as a FROM area. And moving individual object areas by copying Then, a new remaining available area, which is a combination of the area of the TO area where the object area remains usable without moving and the empty FROM area, is set as a new TO area. A partial garbage collection process is performed again as a new FROM area with an area of the same amount as the new remaining available area among the already acquired areas that have not been subjected to the garbage collection processing until the garbage collection processing reaches the entire already acquired area. A dynamic memory management mechanism characterized by repeating the partial garbage collection process similarly thereafter.
【請求項4】 前記ガベージコレクション手段は、部分
ガベージコレクション処理を繰り返す際に、その途中で
新しく生成した残利用可能領域の大きさがある閾値を超
えた場合は、そこで繰り返しを止めることを特徴とする
請求項3記載の動的メモリ管理機構。
4. When the partial garbage collection process is repeated, if the size of the newly generated remaining available area exceeds a certain threshold value during the repetition of the partial garbage collection process, the repetition is stopped there. 4. The dynamic memory management mechanism according to claim 3, wherein:
【請求項5】 前記ガベージコレクション手段は、部分
ガベージコレクション処理を繰り返す前に、まずヒープ
領域外の存在するポインタから参照されるオブジェクト
領域のベースポインタリストを作成し、続いて繰り返さ
れる部分ガベージコレクション処理では、ヒープ領域外
に存在するポインタの代わりに前記ベースポインタリス
トが保持するポインタを用いて処理を行い、前記ポイン
タが参照するオブジェクト領域がTO領域へコピーされ
た場合は、前記ポインタを前記ベースポインタリストか
ら削除することを特徴とする請求項3記載の動的メモリ
管理機構。
5. The garbage collection means, before repeating the partial garbage collection processing, first creates a base pointer list of an object area referenced from an existing pointer outside the heap area, and then repeats the partial garbage collection processing Then, processing is performed using the pointer held by the base pointer list instead of the pointer existing outside the heap area, and when the object area referred to by the pointer is copied to the TO area, the pointer is replaced with the base pointer. The dynamic memory management mechanism according to claim 3, wherein the dynamic memory management mechanism is deleted from the list.
【請求項6】 前記ガベージコレクション手段は、ガベ
ージコレクション処理の繰り返しに際し、TO領域とな
る残利用可能領域がヒープ領域内を常に一方向へ移動す
るよう、残利用可能領域からのオブジェクト領域獲得順
序およびヒープ領域内におけるFROM領域とTO領域
の相対位置を固定させていることを特徴とする請求項3
記載の動的メモリ管理機構。
6. The garbage collection means is configured to obtain an object area from the remaining available area so that the remaining available area, which is a TO area, always moves in one direction in the heap area when the garbage collection process is repeated. The relative position between the FROM area and the TO area in the heap area is fixed.
Dynamic memory management mechanism as described.
【請求項7】 前記ガベージコレクション手段は、ガベ
ージコレクション処理の繰り返しに際し、TO領域とな
る残利用可能領域がヒープ領域内を往復するよう、残利
用可能領域からのオブジェクト領域獲得順序およびヒー
プ領域内におけるFROM領域とTO領域の相対位置を
変化させることを特徴と請求項3記載の動的メモリ管理
機構。
7. The garbage collection means may be configured to obtain an object area from the remaining available area and a heap area so that the remaining available area as a TO area reciprocates in the heap area when the garbage collection process is repeated. 4. The dynamic memory management mechanism according to claim 3, wherein a relative position between the FROM area and the TO area is changed.
【請求項8】 前記ガベージコレクション手段は、TO
領域となる残利用可能領域が小さい時は、既獲得済み領
域からTO領域に隣接して設定するFORM領域をTO
領域の量より大きく設定し、まずFROM領域内の有効
なオブジェクト領域の探索をオブジェクト領域の移動を
伴わずに行い、ついでFORM領域内の有効なオブジェ
クト領域をFROM領域とTO領域を合わせた領域の一
端につめることで、残利用可能領域を大きくしてから、
前記部分ガベージコレクション処理を実行することを特
徴とする請求項3記載の動的メモリ管理機構。
8. The garbage collection means according to claim 1, wherein
When the remaining available area, which is an area, is small, the FORM area set adjacent to the TO area from the already acquired area is set to the TO area.
First, an effective object area in the FROM area is searched for without moving the object area, and then the effective object area in the FORM area is searched for an area obtained by combining the FROM area and the TO area. After filling at one end to increase the remaining available area,
The dynamic memory management mechanism according to claim 3, wherein the partial garbage collection process is performed.
【請求項9】 ヒープ領域と、 前記ヒープ領域からその一部をオブジェクト領域として
獲得するメモリ獲得手段と、 前記獲得したオブジェクト領域を前記ヒープ領域に戻し
再利用可能とするメモリ開放手段と、 前記メモリ獲得手段により獲得されたがプログラムから
利用されなくなったオブジェクト領域を探索し、前記メ
モリ開放手段を用いて前記ヒープ領域へ開放するガベー
ジコレクション手段とを備え、 前記各オブジェクト領域を参照するポインタは、直接に
は参照テーブルのエントリを指し、前記ポインタによる
オブジェクト領域の参照は、必ず前記参照テーブルのエ
ントリを経由して行うことを特徴とする動的メモリ管理
機構。
9. A heap area, a memory obtaining means for obtaining a part of the heap area from the heap area as an object area, a memory releasing means for returning the obtained object area to the heap area for re-use, and the memory Garbage collection means for searching for an object area acquired by the acquisition means but no longer used by the program, and releasing the object area to the heap area by using the memory release means, wherein the pointer for referring to each object area is directly , A reference to an entry of a reference table, and reference of an object area by the pointer is always performed via an entry of the reference table.
【請求項10】 ヒープ領域と、 前記ヒープ領域からその一部をオブジェクト領域として
獲得するメモリ獲得手段と、 前記獲得したオブジェクト領域を前記ヒープ領域に戻し
再利用可能とするメモリ開放手段と、 前記メモリ獲得手段により獲得されたがプログラムから
利用されなくなったオブジェクト領域を探索し、前記メ
モリ開放手段を用いて前記ヒープ領域へ開放するガベー
ジコレクション手段とを備え、 前記ガベージコレクション手段は、周期的に一定時間以
下のみガベージコレクション処理を行うよう動作するこ
とを特徴とする動的メモリ管理機構。
10. A heap area, memory acquisition means for acquiring a part of the heap area as an object area, memory release means for returning the acquired object area to the heap area for reuse, and the memory Garbage collection means for searching for an object area acquired by the acquisition means but no longer being used by the program, and releasing the object area to the heap area using the memory release means. A dynamic memory management mechanism operable to perform garbage collection processing only in the following.
【請求項11】 前記ガベージコレクション手段は、周
期的に一定の比率で真/偽が変化するフラグを参照し、
前記フラグが真の間だけ、ガベージコレクション処理を
行うよう動作することを特徴とする請求項10記載の動
的メモリ管理機構。
11. The garbage collection means refers to a flag that changes true / false periodically at a constant ratio,
11. The dynamic memory management mechanism according to claim 10, wherein the dynamic memory management mechanism operates to perform a garbage collection process only while the flag is true.
【請求項12】 前記ガベージコレクション手段は、 ガベージコレクション処理の実施可否を示すカウンタ
と、 周期的に前記カウンタを適切な値で増加させるカウンタ
増加手段とを有し、 ガベージコレクション処理の進行状況に応じて前記カウ
ンタの値を減算しながら、前記カウンタの値が正の間だ
けガベージコレクション処理を行うよう動作することを
特徴とする請求項10記載の動的メモリ管理機構。
12. The garbage collection means has a counter for indicating whether or not garbage collection processing can be performed, and a counter increasing means for periodically increasing the counter with an appropriate value, according to the progress of the garbage collection processing. 11. The dynamic memory management mechanism according to claim 10, wherein the garbage collection process is performed only while the value of the counter is positive while subtracting the value of the counter.
【請求項13】 前記ガベージコレクション手段は、前
記ヒープ領域内の残利用可能領域の量がある閾値を超え
るまでは、前記カウンタの値が負にあってもガベージコ
レクション処理を継続することを特徴とする請求項12
記載の動的メモリ管理機構。
13. The garbage collection means continues garbage collection processing until the amount of the remaining available area in the heap area exceeds a certain threshold value, even if the value of the counter is negative. Claim 12
Dynamic memory management mechanism as described.
【請求項14】 ヒープ領域と、 前記ヒープ領域からその一部をオブジェクト領域として
獲得するメモリ獲得手段と、 前記獲得したオブジェクト領域を前記ヒープ領域に戻し
再利用可能とするメモリ開放手段と、 前記メモリ獲得手段により獲得されたがプログラムから
利用されなくなったオブジェクト領域を探索し、前記メ
モリ開放手段を用いて前記ヒープ領域へ開放するガベー
ジコレクション手段とを備え、 前記ガベージコレクション手段は、ガベージコレクショ
ン処理を行う契機となった理由、プログラムの動作状
況、動的メモリ管理機構の内部状況、あるいはシステム
の稼動状況などのシステム状態に応じて、適宜異なるガ
ベージコレクション方式を使い分けることを特徴とする
動的メモリ管理機構。
14. A heap area, memory acquisition means for acquiring a part of the heap area from the heap area as an object area, memory release means for returning the acquired object area to the heap area for reuse, and the memory Garbage collection means for searching for an object area acquired by the acquisition means but no longer used by the program, and releasing the object area to the heap area using the memory release means, wherein the garbage collection means performs garbage collection processing A dynamic memory management mechanism characterized by using a different garbage collection method as appropriate according to the system state, such as the trigger, the operating status of the program, the internal status of the dynamic memory management mechanism, or the operating status of the system. .
【請求項15】 前記ガベージコレクション手段は、ヒ
ープ領域内の残利用可能領域の不足により応用プログラ
ムの動作中に前記メモリ獲得手段が応用プログラムから
要求された量のオブジェクト領域を獲得できないため臨
時に行う場合と、あらかじめ設定されていたタイミング
により行う場合とで、異なるガベージコレクション方式
を使い分けることを特徴とする請求項14の動的メモリ
管理機構。
15. The garbage collection means is performed temporarily because the memory acquisition means cannot acquire the amount of object area requested from the application program during the operation of the application program due to a shortage of the remaining available area in the heap area. 15. The dynamic memory management mechanism according to claim 14, wherein different garbage collection methods are used depending on whether the processing is performed at a preset timing.
【請求項16】 前記ガベージコレクション手段は、最
も最近に実施したガベージコレクション処理の後に前記
メモリ獲得手段により獲得され、いまだガベージコレク
ションの処理の対象となったことのないオブジェクト領
域の数に応じて、異なるガベージコレクション方式を使
い分けることを特徴とする請求項14記載の動的メモリ
管理機構。
16. The garbage collection means according to the number of object areas acquired by the memory acquisition means after the most recently performed garbage collection processing and not yet subjected to garbage collection processing, 15. The dynamic memory management mechanism according to claim 14, wherein different garbage collection methods are selectively used.
【請求項17】 前記ガベージコレクション手段は、計
算機システムがシステム立ち上げ段階として動作してい
る場合と、システムの定常段階として動作している場合
とで、異なるガベージコレクション方式を使い分けるこ
とを特徴とする請求項14記載の動的メモリ管理機構。
17. The garbage collection means uses a different garbage collection method depending on whether the computer system is operating as a system startup stage or when the computer system is operating as a steady stage of the system. The dynamic memory management mechanism according to claim 14.
【請求項18】 ヒープ領域と、 前記ヒープ領域からその一部をオブジェクト領域として
獲得するメモリ獲得手段と、 前記獲得したオブジェクト領域を前記ヒープ領域に戻し
再利用可能とするメモリ開放手段と、 前記メモリ獲得手段により獲得されたがプログラムから
利用されなくなったオブジェクト領域を探索し、前記メ
モリ開放手段を用いて前記ヒープ領域へ開放するガベー
ジコレクション手段とを備え、 応用プログラムの動作によりガベージコレクション処理
が必要となると、即座にガベージコレクション処理を行
うのではなく、別途定められたタイミングで行われるガ
ベージコレクション処理が終了するまで、同応用プログ
ラムの動作を停止させることを特徴とした動的メモリ管
理機構。
18. A heap area, a memory obtaining means for obtaining a part of the heap area from the heap area as an object area, a memory releasing means for returning the obtained object area to the heap area for reuse, and the memory Garbage collection means for searching for an object area acquired by the acquisition means but no longer used by the program, and releasing the object area to the heap area by using the memory release means, wherein garbage collection processing is required by the operation of the application program. In this case, a dynamic memory management mechanism that stops the operation of the application program until the garbage collection process performed at a separately determined timing is completed, instead of performing the garbage collection process immediately.
【請求項19】 応用プログラムからの明示的にガベー
ジコレクション指示が行われた場合に、即座にガベージ
コレクション処理を行うのではなく、別途定められたタ
イミングで行われるガベージコレクション処理が終了す
るまで、同応用プログラムの動作を停止させることを特
徴と請求項18記載の動的メモリ管理機構。
19. When an garbage collection instruction is explicitly issued from an application program, the garbage collection process is not performed immediately, but is performed until the garbage collection process performed at a separately determined timing is completed. 19. The dynamic memory management mechanism according to claim 18, wherein the operation of the application program is stopped.
【請求項20】 応用プログラムが前記メモリ獲得手段
を用いてオブジェクト領域を獲得しようとしたときに、
ヒープ領域内の残利用可能領域から応用プログラムが必
要するオブジェクト領域を得られないため、ガベージコ
レクション処理が必要となった場合に、即座にガベージ
コレクション処理を行うのではなく、別途定められたタ
イミングで行われるガベージコレクション処理が終了す
るまで、同応用プログラムの動作を停止させることを特
徴とする請求項18記載の動的メモリ管理機構。
20. When an application program attempts to acquire an object area using the memory acquisition means,
Since the object area required by the application program cannot be obtained from the remaining available area in the heap area, when garbage collection processing becomes necessary, instead of performing garbage collection processing immediately, at a separately determined timing 19. The dynamic memory management mechanism according to claim 18, wherein the operation of the application program is stopped until the garbage collection process to be performed ends.
【請求項21】 複数の応用プログラムがガベージコレ
クション処理の終了を待っている場合に、ガベージコレ
クション処理により増加するヒープ領域内の残利用可能
領域が、各プログラムのそれぞれの要求を満たすように
なった場合、各プログラムは処理の継続が可能となった
時点で順次その停止が解除されることを特徴とする請求
項18記載の動的メモリ管理機構。
21. When a plurality of application programs are waiting for the end of the garbage collection processing, the remaining available area in the heap area increased by the garbage collection processing satisfies each request of each program. 19. The dynamic memory management mechanism according to claim 18, wherein in each case, the suspension of each program is released when the processing can be continued.
【請求項22】 請求項1から請求項21までのいずれ
かに記載の動的メモリ管理機構を実現する計算機システ
ムのプログラムを記録した情報記録媒体。
22. An information recording medium in which a computer system program for realizing the dynamic memory management mechanism according to claim 1 is recorded.
JP14471398A 1998-05-26 1998-05-26 Dynamic memory managing mechanism Pending JPH11338761A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP14471398A JPH11338761A (en) 1998-05-26 1998-05-26 Dynamic memory managing mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP14471398A JPH11338761A (en) 1998-05-26 1998-05-26 Dynamic memory managing mechanism

Publications (1)

Publication Number Publication Date
JPH11338761A true JPH11338761A (en) 1999-12-10

Family

ID=15368572

Family Applications (1)

Application Number Title Priority Date Filing Date
JP14471398A Pending JPH11338761A (en) 1998-05-26 1998-05-26 Dynamic memory managing mechanism

Country Status (1)

Country Link
JP (1) JPH11338761A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011505042A (en) * 2007-11-29 2011-02-17 インターナショナル・ビジネス・マシーンズ・コーポレーション Memory management

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011505042A (en) * 2007-11-29 2011-02-17 インターナショナル・ビジネス・マシーンズ・コーポレーション Memory management
JP4701321B2 (en) * 2007-11-29 2011-06-15 インターナショナル・ビジネス・マシーンズ・コーポレーション Memory management
US8346822B2 (en) 2007-11-29 2013-01-01 International Business Machines Corporation Memory management

Similar Documents

Publication Publication Date Title
US11775429B2 (en) NUMA-aware garbage collection
US6865585B1 (en) Method and system for multiprocessor garbage collection
CN1154928C (en) Resource management method and apparatus for information processing system of multitasking facility
US6862674B2 (en) Methods and apparatus for performing a memory management technique
KR100715638B1 (en) Memory reclamation method
US8245239B2 (en) Deterministic runtime execution environment and method
US6314436B1 (en) Space-limited marking structure for tracing garbage collectors
US7010555B2 (en) System and method for compacting a computer system heap
US9037830B2 (en) Organization of a small object area and a large object area in a Java heap
JP2003507814A (en) Garbage collector based on the train algorithm using a fixed-size membered set
US20120254267A1 (en) Numa-aware garbage collection
KR100846499B1 (en) Method and apparatus for managing memory
JPH04195577A (en) Task scheduling system for multiprocessor
JP4756231B2 (en) Method, computer readable medium, computer system, and memory for enhancing the effectiveness of garbage collection for cleaning
US6427154B1 (en) Method of delaying space allocation for parallel copying garbage collection
KR100772872B1 (en) Apparatus and method for managing resource using virtual ID under multiple java applications environment
JPH11338761A (en) Dynamic memory managing mechanism
Wei et al. Practically and theoretically efficient garbage collection for multiversioning
US10936483B2 (en) Hybrid garbage collection
JP4050855B2 (en) Garbage collection apparatus and method
US6842838B2 (en) Preemptive memory-block splitting
Lueh et al. Global register allocation based on graph fusion
JP2000099351A (en) Program controller and memory allocation device and method
JPH09244931A (en) Real-time file system
JP4860240B2 (en) Translation method and execution notification instruction embedding method