JP2008065735A - Dynamic memory management method - Google Patents

Dynamic memory management method Download PDF

Info

Publication number
JP2008065735A
JP2008065735A JP2006245203A JP2006245203A JP2008065735A JP 2008065735 A JP2008065735 A JP 2008065735A JP 2006245203 A JP2006245203 A JP 2006245203A JP 2006245203 A JP2006245203 A JP 2006245203A JP 2008065735 A JP2008065735 A JP 2008065735A
Authority
JP
Japan
Prior art keywords
memory
data
memory block
size
block
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
JP2006245203A
Other languages
Japanese (ja)
Inventor
Masayuki Nakamura
賢之 中村
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2006245203A priority Critical patent/JP2008065735A/en
Publication of JP2008065735A publication Critical patent/JP2008065735A/en
Pending legal-status Critical Current

Links

Abstract

<P>PROBLEM TO BE SOLVED: To solve problems that a system which uses a dynamic memory is unstable or non-operationable due to memory shortage in an embedded device with a small RAM capacity. <P>SOLUTION: A dynamic memory management method which dynamically acquires and returns memory blocks includes a step for adding data which indicates that data is not rewritten after writing the data into an acquired memory block, a step for measuring the number of references to a memory block and adding it to data, a step for comparing the content of data when writing is completed with the content of data in another memory block, and a step for storing only either of the blocks and returning the other memory block if the comparison result at the comparison step is the same. Thereby, the amount of memory use is reduced and memory shortage is prevented, so that the stability of the whole of a system is improved. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、ランダムアクセスメモリ(RAM)を使用する機器においてメモリのサイズを小さくするための動的メモリ管理方式に関するものである。   The present invention relates to a dynamic memory management system for reducing the size of a memory in a device using a random access memory (RAM).

従来の一般的な動的メモリ管理方式では、獲得要求時にはメモリが無くなるまで無条件に割り当てを行なっていた。従ってある特定の処理がメモリを大量に消費してシステム全体のメモリ資源が枯渇すると、他の全ての処理がメモリを獲得できなくなり、システムが異常動作したり停止するという課題があった。   In the conventional general dynamic memory management method, when an acquisition request is made, allocation is unconditionally performed until there is no more memory. Therefore, when a specific process consumes a large amount of memory and the memory resources of the entire system are exhausted, all other processes cannot acquire the memory, causing a problem that the system operates abnormally or stops.

前記課題の対策についての従来技術として、メモリの使用量や処理の優先度を考慮してメモリ獲得の制限を行なうことで、重要な処理が動作不能になることを防ぐ技術(特許文献1)が存在するが、比較的重要度の低い処理の場合にはメモリが残っていても動作できなくなり、システムの信頼性が低下する、若しくは重要度の高い処理が異常に大量のメモリを消費した場合には効果がないなどの課題があった。   As a conventional technique for dealing with the above problem, there is a technique (Patent Document 1) that prevents important processes from becoming inoperable by limiting memory acquisition in consideration of memory usage and processing priority. If there is a process with relatively low importance, but it cannot operate even if memory remains, the reliability of the system decreases, or a process with high importance consumes an abnormally large amount of memory There were issues such as ineffectiveness.

また、データを書き換えない静的なメモリであるリードオンリーメモリ(ROM)において同一データに対してアドレス変換を行うことで仮想的に容量を拡大する技術(特許文献2)が存在するが、データが常に変化するランダムアクセスメモリには適用できないものである。
特開2004−046462号公報 特開平6−348586号公報
Further, there is a technology (Patent Document 2) that virtually expands the capacity by performing address conversion on the same data in a read-only memory (ROM) that is a static memory that does not rewrite data. It cannot be applied to a random access memory that changes constantly.
JP 2004-046462 A JP-A-6-348586

従来の動的メモリ管理方式では、ある特定の処理がメモリを大量に消費するなどしてメモリの残り容量が少なくなるとメモリが割り当てられなくなり、必要な処理ができず、システムが異常動作を起こすなど不安定になる、もしくは停止してしまうなどの課題があった。   In the conventional dynamic memory management method, when a specific process consumes a large amount of memory and the remaining memory capacity is low, the memory cannot be allocated, the necessary processing cannot be performed, and the system operates abnormally. There were problems such as becoming unstable or stopping.

本発明は、上記課題を解決するものであり、書き換え可能なメモリにおいて、必要な期間のみ必要なサイズのメモリブロックを動的に獲得、返却する動的メモリ管理方式であって、獲得したメモリブロックへのデータ書き込みが完了した後にデータを書き換えないことを示すデータを付加するステップと、メモリブロックが参照されている数を計測しデータに付加するステップと、書き込み完了時のデータの内容を他のメモリブロックのデータ内容と比較するステップと、前記比較するステップによる比較結果が同一の場合に、一方のメモリブロックのみを保持し他方のメモリブロックを返却するステップとを含む。   The present invention solves the above-mentioned problem, and is a dynamic memory management system for dynamically acquiring and returning a memory block having a required size only for a required period in a rewritable memory. A step of adding data indicating that data is not rewritten after data writing to the memory is completed, a step of measuring the number of memory blocks that are referred to, and adding the data to the data; A step of comparing with the data content of the memory block, and a step of holding only one memory block and returning the other memory block when the comparison result of the comparing step is the same.

以上のように本発明によれば、同一データの異常な繰り返し入力やメモリの返却漏れによる同一データの使用が蓄積する場合など、同一データを多数使用した際のメモリの使用量を減らすことができ、メモリの枯渇を防ぎシステム全体の安定性を向上させることができる。   As described above, according to the present invention, it is possible to reduce the amount of memory used when a large number of the same data is used, such as when the same data is accumulated due to abnormal repeated input of the same data or memory return failure. It is possible to prevent memory depletion and improve the stability of the entire system.

本発明を実施するための形態について、図面を用いて説明する。   Embodiments for carrying out the present invention will be described with reference to the drawings.

(実施の形態1)
図1において1はRAM回路全体、2はRAMの一部を動的に割り当てるために一定サイズのメモリブロックを複数用意している動的メモリ(メモリプール)をそれぞれ示している。メモリプールはRAMのアドレスの範囲として定義し、各メモリブロックには管理用に書き込み完了を示すフラグと参照数を記憶するエリアを付加しておく。
(Embodiment 1)
In FIG. 1, reference numeral 1 denotes an entire RAM circuit, and 2 denotes a dynamic memory (memory pool) in which a plurality of memory blocks of a certain size are prepared in order to dynamically allocate a part of the RAM. A memory pool is defined as a range of RAM addresses, and a flag indicating completion of writing and an area for storing the number of references are added to each memory block for management.

このように構成されるRAM回路1において、動的にメモリを獲得、返却する際の動作を図2から図5のフローチャートを用いて説明する。   In the RAM circuit 1 configured as described above, the operation when the memory is dynamically acquired and returned will be described with reference to the flowcharts of FIGS.

RAM回路1の全体の動作を図2に示す。RAM回路1は、まずメモリの獲得処理を行う(ステップ100)。メモリ獲得処理の詳細を図3に示す。   The overall operation of the RAM circuit 1 is shown in FIG. The RAM circuit 1 first performs a memory acquisition process (step 100). The details of the memory acquisition process are shown in FIG.

処理10がメモリを必要とする場合、メモリの獲得を要求する。RAM回路1はメモリプールの中から参照数が0である未使用のメモリブロックを探し(ステップ110)、メモリブロックが存在する場合(ステップ110で「YES」の場合)には、そのメモリブロック20の完了フラグを0、参照数のデータを1にした(ステップ120)後に、メモリブロック20のアドレスを返す(ステップ130)。未使用のメモリブロックが存在しない場合(ステップ110で「NO」の場合)には、エラーを返す(ステップ140)。   If process 10 requires memory, it requests memory acquisition. The RAM circuit 1 searches the memory pool for an unused memory block having a reference number of 0 (step 110). If there is a memory block (in the case of “YES” in step 110), the memory block 20 After the completion flag is set to 0 and the reference number data is set to 1 (step 120), the address of the memory block 20 is returned (step 130). If there is no unused memory block (“NO” in step 110), an error is returned (step 140).

処理10は、その後、図2に示すように獲得したアドレスのメモリブロック20に対して、データの書き込みを行う(ステップ200)。   Then, the process 10 writes data to the memory block 20 at the acquired address as shown in FIG. 2 (step 200).

その後、RAM回路1は、メモリチェック処理を行う(ステップ300)。メモリチェック処理の詳細を図4に示す。   Thereafter, the RAM circuit 1 performs a memory check process (step 300). Details of the memory check process are shown in FIG.

処理10が書き込んだデータを以後メモリプールに返却するまで書き換えない場合、RAM回路1に書き込み完了を通知する。RAM回路1は書き込み完了通知を受信すると、メモリブロックの完了フラグに1を書き込む(ステップ310)。この時のメモリプールの状態を図5に示す。RAM回路1は、参照数が0より大きく、完了フラグが1で、かつメモリブロック内の全データが一致するものがあるかどうかを検索する(ステップ320)。図5の状態では、該当するメモリブロックは存在しないため、書き込んだメモリブロックのアドレスを返して(ステップ36)、処理を終了する。   When the data written by the process 10 is not rewritten until it is returned to the memory pool thereafter, the RAM circuit 1 is notified of the completion of writing. When the RAM circuit 1 receives the write completion notification, it writes 1 in the completion flag of the memory block (step 310). The state of the memory pool at this time is shown in FIG. The RAM circuit 1 searches whether there is a data whose reference number is greater than 0, the completion flag is 1, and all the data in the memory block match (step 320). In the state of FIG. 5, since the corresponding memory block does not exist, the address of the written memory block is returned (step 36), and the process is terminated.

次に処理10がメモリを獲得した後に、処理11がメモリを必要する場合について説明する。処理11はメモリブロック21を獲得し(ステップ100)、データを書き込み(ステップ200)、データの書き込み完了を通知すると、完了フラグに1が書き込まれる(ステップ310)。この時のメモリプールの状態を図6に示す。動的メモリの中で参照数が0より大きく、完了フラグが1で、かつメモリブロック内の全データが一致するものがあるかどうかを検索する(ステップ320)。図6の状態では、メモリブロック20が該当するため、メモリブロック20の参照数を1増加し(ステップ330)、メモリブロック21を返却し(ステップ340)、メモリブロック20のアドレスを返し、処理11は以後メモリブロック20を参照して処理を続ける(ステップ350)。この時のメモリプールの状態を図7に示す。   Next, the case where the process 11 needs the memory after the process 10 acquires the memory will be described. The process 11 acquires the memory block 21 (step 100), writes data (step 200), and notifies the completion flag of the data when 1 is written (step 310). The state of the memory pool at this time is shown in FIG. In the dynamic memory, it is searched whether there is a reference number greater than 0, a completion flag is 1, and all data in the memory block match (step 320). In the state of FIG. 6, since the memory block 20 corresponds, the reference number of the memory block 20 is increased by 1 (step 330), the memory block 21 is returned (step 340), the address of the memory block 20 is returned, and the process 11 Thereafter, the processing is continued with reference to the memory block 20 (step 350). The state of the memory pool at this time is shown in FIG.

このようなメモリブロックの使用例として、例えばテレビにおいてリモコンにより次々と入力されるキーに対応するリモコンコードをそれぞれの処理が完了するまで記憶しておくような場合、一旦入力されたリモコンコードをメモリブロックに記録した後は処理が完了するまで書き換えることはない。従って、このような処理においては、リモコンコードの書き込みが完了した時点で、同一データを検索し一つにまとめる処理を行なうことによって、メモリの使用量を減らすことができ、メモリの枯渇を防ぎシステム全体の安定性を向上させることができる。   As an example of the use of such a memory block, for example, when storing remote control codes corresponding to keys successively input by a remote controller on a television until each processing is completed, the remote control codes once input are stored in the memory. After recording in the block, it is not rewritten until the processing is completed. Therefore, in such processing, when the writing of the remote control code is completed, it is possible to reduce the amount of memory used by searching for and collecting the same data, and to prevent the memory from being exhausted. The overall stability can be improved.

図1において、処理12はメモリブロック21を獲得し、同じデータを書き込むが、完了を通知しない限り今後書き換える可能性があるので上記処理は行わない。処理13はメモリブロック22を獲得し、データを書き込み完了を通知するが、メモリブロック22はデータ内容が一致しないため同様に上記処理は行わない。   In FIG. 1, a process 12 acquires a memory block 21 and writes the same data, but the above process is not performed because there is a possibility of rewriting in the future unless a completion is notified. The process 13 acquires the memory block 22 and notifies the completion of writing the data, but the memory block 22 does not perform the above process similarly because the data contents do not match.

処理10が処理を終え、メモリブロック20の返却を要求した場合の処理フローを図8に示す。この場合、メモリブロック20の参照数を1減少させる(ステップ400)。参照数が0にならない限りメモリブロックはまだ使用中であり、他の処理がメモリ獲得を要求しても割り当てすることはない。 (実施の形態2)
実施の形態1ではメモリブロックのデータのサイズを一定としたが、任意のサイズのメモリを割り当てる不定長の動的メモリ管理においても、メモリのサイズを比較の条件に加えることで本発明を実施することができるのは明らかである。
FIG. 8 shows a processing flow when the processing 10 finishes the processing and requests return of the memory block 20. In this case, the reference number of the memory block 20 is decreased by 1 (step 400). As long as the reference number does not become 0, the memory block is still in use and is not allocated even if another process requests memory acquisition. (Embodiment 2)
Although the data size of the memory block is fixed in the first embodiment, the present invention is implemented by adding the memory size to the comparison conditions even in dynamic memory management of indefinite length in which a memory of an arbitrary size is allocated. Obviously you can.

(実施の形態3)
実施の形態1では未使用または使用中のメモリブロックの検索を参照数が0か否かを条件として実施しているが、検索を高速に行なうために未使用または使用中のメモリアドレスをリスト構造で管理する場合でも本発明を実施することができるのは明らかである。
(Embodiment 3)
In the first embodiment, a search for an unused or in-use memory block is performed on the condition that the number of references is 0 or not. However, in order to perform a search at a high speed, the memory addresses that are not in use or in use are listed. It is clear that the present invention can be implemented even when managed by

本発明の動的メモリ管理方式は、特にRAMの容量が小さな組み込み機器などで動的メモリを使用する場合に、メモリの枯渇を防ぎ、システムが安定して動作することができるため、有用である。   The dynamic memory management method of the present invention is useful because it can prevent the memory from being exhausted and the system can operate stably, especially when using dynamic memory in an embedded device having a small RAM capacity. .

本発明の一実施の形態におけるメモリ管理の概念図The conceptual diagram of the memory management in one embodiment of this invention 本発明の一実施の形態における動的メモリ管理全体のフローチャートFlowchart of overall dynamic memory management in an embodiment of the present invention 本発明の一実施の形態におけるメモリ獲得処理のフローチャートThe flowchart of the memory acquisition process in one embodiment of this invention 本発明の一実施の形態におけるメモリチェック処理のフローチャートFlow chart of memory check processing in an embodiment of the present invention 本発明の一実施の形態におけるメモリブロック確保時の概念図The conceptual diagram at the time of memory block reservation in one embodiment of this invention 本発明の一実施の形態における複数のメモリブロック確保時の概念図Conceptual diagram when securing a plurality of memory blocks in an embodiment of the present invention 本発明の一実施の形態におけるメモリチェック処理後の概念図The conceptual diagram after the memory check process in one embodiment of this invention 本発明の一実施の形態におけるメモリ返却処理のフローチャートFlow chart of memory return processing in one embodiment of the present invention

符号の説明Explanation of symbols

1 ランダムアクセスメモリ(RAM)回路
2 動的メモリ(メモリプール)
10〜13 メモリブロックを使用する処理
20〜24 メモリブロック
1 Random Access Memory (RAM) Circuit 2 Dynamic Memory (Memory Pool)
Processing using 10-13 memory blocks 20-24 Memory blocks

Claims (4)

書き換え可能なメモリにおいて、必要な期間のみ必要なサイズのメモリブロックを動的に獲得、返却する動的メモリ管理方式であって、
獲得したメモリブロックへのデータ書き込みが完了した後にデータを書き換えないことを示すデータを付加するステップと、
メモリブロックが参照されている数を計測しデータに付加するステップと、
書き込み完了時のデータの内容を他のメモリブロックのデータ内容と比較するステップと、
前記比較するステップによる比較結果が同一の場合に、一方のメモリブロックのみを保持し他方のメモリブロックを返却するステップとを含む動的メモリ管理方式。
In a rewritable memory, a dynamic memory management system that dynamically acquires and returns a memory block of a required size only for a required period,
Adding data indicating that data is not rewritten after data writing to the acquired memory block is completed;
Measuring the number of referenced memory blocks and adding them to the data;
Comparing the data contents at the completion of writing with the data contents of other memory blocks;
And a step of holding only one memory block and returning the other memory block when the comparison result of the comparing step is the same.
請求項1記載の動的メモリ管理方式であって、
メモリを一定サイズのメモリブロック単位で管理するステップと、
メモリブロック単位でデータの比較を行なうステップとをさらに含む動的メモリ管理方式。
The dynamic memory management system according to claim 1,
Managing memory in units of a certain size memory block;
And a step of comparing data in units of memory blocks.
請求項1記載の動的メモリ管理方式であって、
メモリブロックのサイズが不定長である場合にメモリのサイズをデータに付加するステップと、
同一サイズのメモリブロック間でのみデータを比較するステップとをさらに含む動的メモリ管理方式。
The dynamic memory management system according to claim 1,
Adding a memory size to the data when the memory block size is indefinite;
And a method of comparing data only between memory blocks of the same size.
請求項1記載の動的メモリ管理方式であって、
メモリブロックのサイズが不定長である場合にメモリのサイズをデータに付加するステップと、
前記メモリブロックのサイズ以上のサイズを持ったメモリブロックの中から前記メモリブロックのサイズ分だけデータを比較するステップとをさらに含む動的メモリ管理方式。
The dynamic memory management system according to claim 1,
Adding a memory size to the data when the memory block size is indefinite;
And a step of comparing data corresponding to the size of the memory block from memory blocks having a size equal to or larger than the size of the memory block.
JP2006245203A 2006-09-11 2006-09-11 Dynamic memory management method Pending JP2008065735A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006245203A JP2008065735A (en) 2006-09-11 2006-09-11 Dynamic memory management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006245203A JP2008065735A (en) 2006-09-11 2006-09-11 Dynamic memory management method

Publications (1)

Publication Number Publication Date
JP2008065735A true JP2008065735A (en) 2008-03-21

Family

ID=39288381

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006245203A Pending JP2008065735A (en) 2006-09-11 2006-09-11 Dynamic memory management method

Country Status (1)

Country Link
JP (1) JP2008065735A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009245437A (en) * 2008-03-31 2009-10-22 Konica Minolta Systems Lab Inc Memory management method for rasterization, computer readable medium, and computer readable memory

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009245437A (en) * 2008-03-31 2009-10-22 Konica Minolta Systems Lab Inc Memory management method for rasterization, computer readable medium, and computer readable memory

Similar Documents

Publication Publication Date Title
US9817588B2 (en) Memory device and operating method of same
US8838928B2 (en) Memory management and method for allocation using free-list
KR101357397B1 (en) Method for tracking memory usages of a data processing system
JP6014925B2 (en) Memory recovery method and apparatus
JP5868429B2 (en) Method, computer program product, and apparatus for progressively unloading classes using a region-based garbage collector
US9355028B2 (en) Data-storage device and flash memory control method
US7721040B2 (en) Method and system for facilitating fast wake-up of a flash memory system
US8909853B2 (en) Methods and apparatus to share a thread to reclaim memory space in a non-volatile memory file system
JP5669531B2 (en) Method, apparatus and computer program for speeding up system startup time
US11314689B2 (en) Method, apparatus, and computer program product for indexing a file
TW201202926A (en) Memory management device and memory management method
US11262830B2 (en) Managing ephemeral storage on a computing node
US20060149915A1 (en) Memory management technique
JP2009122733A (en) Power control method, computer system, and program
CN110888769B (en) Data processing method and computer equipment
US9395930B2 (en) Information processing system, control method of information processing system, and recording medium
JP6306548B2 (en) Memory management circuit, storage device, memory management method, and memory management program
JP2008065735A (en) Dynamic memory management method
JP2007264692A (en) Memory management method, device and program
CN113360092A (en) Data storage method, data storage device and electronic equipment
CN113760781A (en) Data processing method and device, electronic equipment and storage medium
CN112000471B (en) Memory optimization method and device
CN114265559A (en) Storage management method and device, electronic equipment and storage medium
CN116303810A (en) Data processing method, device, medium and computing equipment
JP2021140464A (en) Storage device, storage system and method