Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP3610528B2 - Memory management method and apparatus - Google Patents
[go: Go Back, main page]

JP3610528B2 - Memory management method and apparatus - Google Patents

Memory management method and apparatus Download PDF

Info

Publication number
JP3610528B2
JP3610528B2 JP02878695A JP2878695A JP3610528B2 JP 3610528 B2 JP3610528 B2 JP 3610528B2 JP 02878695 A JP02878695 A JP 02878695A JP 2878695 A JP2878695 A JP 2878695A JP 3610528 B2 JP3610528 B2 JP 3610528B2
Authority
JP
Japan
Prior art keywords
area
memory management
allocated
memory
size
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.)
Expired - Fee Related
Application number
JP02878695A
Other languages
Japanese (ja)
Other versions
JPH08202611A (en
Inventor
博幸 佐々木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Brother Industries Ltd
Original Assignee
Brother Industries 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 Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP02878695A priority Critical patent/JP3610528B2/en
Publication of JPH08202611A publication Critical patent/JPH08202611A/en
Application granted granted Critical
Publication of JP3610528B2 publication Critical patent/JP3610528B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【産業上の利用分野】
本発明は、パーソナルコンピュータ、プリンタ等の情報処理機器に搭載されたメモリを管理するメモリ管理方法及び装置に関するものである。
【0002】
【従来の技術】
従来、パーソナルコンピュータ、プリンタ等の情報処理機器におけるメモリ管理は、基本的にアプリケーションプログラムから要求されたプログラムサイズに相当するメモリ領域の割り当て、割り当て済みの領域のサイズ変更、及び割り当て済み領域の解放といった処理を、保有するメモリ空間において行っている。
【0003】
従来のメモリ管理方法について図11(a)〜(i)を参照して説明する。ここでは、割り当て済み領域がメモリ空間中を移動することが可能なメモリ管理方法(以下、動的メモリ管理方法、また、その割り当てられた領域を動的な属性を持つ領域という)について説明する。アプリケーションプログラムに割り当てられるRAM等のメモリの連続したメモリ領域100において、図11(a)に示すように、下位アドレスから上位アドレスに向かう順に既に領域D1,D2,D3,D4(それぞれのサイズをSD1 ,SD2 ,SD3 ,SD4 とする)が割り当て済みで、領域F1,F2,F3,F4,F5(それぞれのサイズをSF1 ,SF2 ,SF3 ,SF4 ,SF5 とする)が空いているとする。いま、アプリケーションプログラムよりサイズSD5 の領域割り当て要求があった場合、サイズSD5 と、空き領域F1〜F5のそれぞれのサイズ(SF1 〜SF5 )とを比較する。その結果、領域F4のサイズSF4 がサイズSD5 の領域の確保に十分ならば、図11(b)に示すように、領域F4にサイズSD5 のプログラムを割り当て、この領域をD5とし、領域F4の余った空き領域をF6(サイズSF6=SF4-SD5 )とする。
【0004】
しかし、割り当てようとする領域のサイズSD5 と、空き領域F1からF4のそれぞれの大きさを比較し、十分な領域が見つからなかった場合、既に割り当て済みの領域D1〜D4を、下位アドレス側に移動することにより、図11(c)に示すように、新たな空き領域F7(サイズSF7=SF1+SF2+SF3+SF4+SF5 )を作り出し、空き領域F7にサイズSD5 の領域を割り当て、図11(d)に示すように、ここをD5とし、D5を割り当ることにより余った空き領域をF8(サイズSF8=SF7-SD5 ) とする。
【0005】
また、図11(a)の状態で割り当て済みの領域D2のサイズをSD2 からSD2Lに拡大する場合、例えば、SD2L>SD2+SF3 かつSD2L≦SD2+SF3+SF4 ならば、図11(e)に示すように、領域D3を上位アドレス方向、つまり領域D4側へ移動することにより空き領域F9を作り出し、図11(f)に示すように、領域D2を拡大することによりサイズSD2Lの領域を新たに割り当てる。さらに、図11(a)に示す状態で、SD2L>SD2+SF1+SF2+SF3+SF4 かつSD2L>SD2+SF1+SF2+SF3+SF4+SF5 のような場合では、まず、図11(g)に示すように、領域D1,D2を下位アドレス方向に移動し、領域D3,D4を上位アドレス方向に移動することにより、連続した空き領域F11 を作り出し、図11(h)に示すように、領域D2を拡大したD2L を新たに割り当て、D2L を割り当てることにより余った空き領域をF12 とする。また、図11(a)の状態で領域D2を解放した場合、図11(i)に示すように新たな連続の空き領域F13 (サイズSF13=SF2+SD2+SF3)が作り出される。
【0006】
【発明が解決しようとする課題】
しかしながら、上記のような従来のメモリ管理方法においては、総ての領域がアプリケーションプログラムに対し移動可能な動的な属性で割り当てられている場合、メモリの空き領域の合計が0になるまで、新たな領域の割り当て、領域サイズの変更等が可能であったが、プログラムにおける処理の効率化から割り当て済みの領域がメモリ空間中を移動不可な静的な属性で領域を割り当てることがある。例えば、図11(a)に示すように、既に領域D1,D2,D3,D4にそれぞれプログラムが割り当て済みで、領域F1,F2,F3,F4,F5が空いている。領域D3が移動不可な静的属性で領域を割り当てられているとする。このとき、前出のようなD2のサイズをSD2 からSD2Lに大きくする要求がなされた場合、SD2L>SD2+SF1+SF2+SF3+SF4+SF5 にも関わらず、領域D3が移動不可なために図11(g)に示したような空き領域F11 が作り出せない。そのためにD2のサイズの拡大は不可能である。つまり、移動不可な静的属性を持つ領域がメモリ空間の中央付近に存在すると、空き領域が十分存在するにも関わらずメモリの新規割り当て、割り当てサイズの変更が不可能な場合が発生する。また、上述のような不都合から、割り当てられたプログラムの移動の頻度が増えたり、記憶されたプログラムが細分化されてメモリ空間の空き領域を効率よく使用できないといった問題が生じていた。
【0007】
本発明は、上述した問題点を解決するためになされたものであり、一つの連続したメモリ空間において、領域の静的又は動的の割り当て属性の違いよってメモリ空間への割り当て領域を分離することにより、メモリの使用効率を高め、メモリ空き領域の新たな領域の割り当てや割り当て済み領域のサイズの変更を効率よく行うことが可能なメモリ管理方法及び装置を提供することを目的とする。
【0008】
【課題を解決するための手段】
上記目的を達成するために請求項1の発明のメモリ管理方法は、一つの連続したメモリ空間において2つのメモリ管理を行うことができるメモリ管理方法において、アプリケーションプログラムに対して割り当て済みの領域が他の領域の新規割り当てあるいは他の領域のサイズ変更に伴い再配置されることがなく、かつメモリ空間は予め定めたサイズの単位ブロックを単位として管理されると共に、アプリケーションプログラムに対して割り当てる領域のサイズは前記単位ブロックの整数倍に設定された静的なメモリ管理を行う第1のメモリ管理方式と、アプリケーションプログラムに対して割り当て済みの領域が他の領域の新規割り当てあるいは他の領域のサイズ変更に伴い移動再配置されることがある動的なメモリ管理を行う第2のメモリ管理方式とを備え、前記第1のメモリ管理方式は、前記メモリ空間の一端から前記単位ブロックを単位として割り当て領域を配置し、前記第2のメモリ管理方式は、前記メモリ空間の他端から割り当て領域を配置し、前記第1のメモリ管理方式は、新規割り当てあるいはサイズ変更を実行するために必要な空きブロックが無かった場合には前記第2のメモリ管理方式に対して領域の整頓の要求を出し、前記第2のメモリ管理方式は、前記第1のメモリ管理方式からの領域の整頓の要求に応じて割り当て済みの領域を前記他端側に詰めるように移動配置するものである。
また、請求項2の発明のメモリ管理装置は、一つの連続したメモリ空間において2つのメモリ管理を行うことができるメモリ管理装置において、アプリケーションプログラムに対して割り当て済みの領域が他の領域の新規割り当てあるいは他の領域のサイズ変更に伴い再配置されることがなく、かつメモリ空間は予め定めたサイズの単位ブロックを単位として管理されると共に、アプリケーションプログラムに対して割り当てる領域のサイズは前記単位ブロックの整数倍に設定された静的なメモリ管理を行う第1のメモリ管理手段と、アプリケーションプログラムに対して割り当て済みの領域が他の領域の新規割り当てあるいは他の領域のサイズ変更に伴い移動再配置されることがある動的なメモリ管理を行う第2のメモリ管理手段とを備え、前記第1のメモリ管理手段は、前記メモリ空間の一端から前記単位ブロックを単位として割り当て領域を配置し、前記第2のメモリ管理手段は、前記メモリ空間の他端から割り当て領域を配置し、前記第1のメモリ管理手段は、新規割り当てあるいはサイズ変更を実行するために必要な空きブロックが無かった場合には前記第2のメモリ管理手段に対して領域の整頓の要求を出し、前記第2のメモリ管理手段は、前記第1のメモリ管理手段からの領域の整頓の要求に応じて割り当て済みの領域を前記他端側に詰めるように移動配置するものである。
【0009】
【作用】
上記請求項1又は請求項2のメモリ管理方法又は装置においては、アプリケーョンプログラムからのメモリの割り当て要求に応じて、静的なメモリ管理を行う第1のメモリ管理方式又は手段はメモリ空間の一端から前記単位ブロックを単位として割り当て領域を配置し、また、動的なメモリ管理を行う第2のメモリ管理方式又は手段はメモリ空間の他端から割り当て領域を配置する。そして、第1のメモリ管理方式又は手段は、新規割り当てあるいはサイズ変更を実行するために必要な空きブロックが無かった場合には第2のメモリ管理方式又は手段に対して領域の整頓の要求を出し、第2のメモリ管理方式又は手段は、第1のメモリ管理方式又は手段からの領域の整頓の要求に応じて割り当て済みの領域を前記他端側に詰めるように移動配置する。これにより、メモリの空き領域の新たな領域の割り当てや割り当て済み領域のサイズ変更を効率よく行うことができるものであり、しかも、アプリケーションプログラムに対して割り当てる領域のサイズを前記単位ブロックの整数倍としたので、細分化された領域がメモリ空間中に点在して大きな空き領域を作り出せないといったことがなくなり、また、メモリ空間の細分化が抑制され、効率よくメモリ管理を行え、大きな空き領域を確保することができる。
【0010】
【0011】
【実施例】
以下、本発明を具体化した一実施例を図面を参照して説明する。図1は、本実施例のメモリ管理装置をプリンタコントローラに実装した場合の概略ブロック図である。メモリ管理装置は、ホストコンピュータ1から送られてきた印刷命令等を処理しプリンタエンジン2に処理された印刷イメージを転送するプリンタコントローラ3に搭載され、本発明によるメモリ管理方法はこのプリンタコントローラ3全体を制御するCPU4により実行される。プリンタコントローラ3は、前記CPU4の他に、プリンタエンジン2を制御するための制御プログラム及びフォントデータを格納したROM5と、RAM6と、ホストコンピュータ1などの外部装置との通信を行う入出力インターフェース7と、プリンタエンジン2との通信を行うプリンタエンジンインターフェース8と、これらを相互に接続するバス9とから構成される。
【0012】
上記構成のメモリ管理装置において、CPU4は、ROM5に格納されているプリンタ制御プログラムに含まれるメモリ管理プログラムに基づいてRAM6のメモリ領域を管理し、プリンタ制御プログラムからの要求により、RAM6のメモリ空間に領域を割り当てる。例えば、ホストコンピュータ1から送られてくる印刷データを一時的に蓄える受信バッファとしての領域や、印字データを処理する途中で生成される中間データを蓄える領域などは静的属性領域に割り当て、一時的に蓄えられる(キャッシュされる)フォントデータなどは動的属性領域に割り当てるようにしている。
【0013】
図2は、図1のRAM6の記憶領域の概念を示す図である。メモリは連続したメモリ空間60を想定する。メモリ空間60は、一番下位アドレスをMemLoEnd61、一番上位のアドレスをMemHiEnd62で示し、メモリの上位アドレスから下位アドレスへ向かう方向に静的属性を持つ領域が割り当てられ、下位アドレスから上位アドレスへ向かう方向に動的属性を持つ領域が割り当てられる。以降、前者を静的メモリ管理、後者を動的メモリ管理という。図示するメモリ空間60の中で、ハッチングで示した領域は既に割り当てられている領域であり、ハッチングが無い部分は割り当てられていない空き領域である。
【0014】
静的メモリ管理は、アプリケーションプログラム(本実施例では、プリンタ制御プログラム)が必要とするサイズの領域をMemStEnd62から、順番にMemLoEnd61方向に向かって割り当てる。メモリ空間60にはMemHiEnd62の直前に静的メモリ管理のための管理領域63が確保され、管理領域63の直前をMemStEnd64で示す。MemStEnd64とStAreaBottom65の間の領域66が、静的メモリ管理で使用されている領域である。StAreaBottom65で示すアドレスが、静的メモリ管理によって割り当てられている領域の先端であり、StAreaBottom65は、領域の割り当て、解放によって移動する。
【0015】
動的メモリ管理は、アプリケーションプログラムが必要とするサイズの領域をMemLoEnd61から、順番にMemStEnd64方向に向かって割り当てる。MemLoEnd61とDyAreaTop 67の間の領域68が動的メモリ管理で使用されている領域である。DyAreaTop 67で示すアドレスが動的メモリ管理によって割り当てられている領域の先端であり、DyAreaTop 67は、領域の割り当て、解放によって移動する。また、DyAreaTop 67とStAreaBottom65の領域69は、静的・動的メモリ管理のどちらにも管理されていない未使用の空き領域である。
【0016】
次に、静的メモリ管理の基本的な機能(領域の割り当て、割り当て済み領域のサイズ変更、割り当て済み領域の開放)について、図3から図6を用いて説明する。図3は、静的な属性に割り当てられている空間周辺を示したメモリ空間60の概念図である。静的メモリ管理においては、使用可能な空間(MemLoEnd61〜MemStEnd64)をある一定のサイズで分割しておく。この一つ一つを単位ブロックと呼ぶ。単位ブロックのサイズは、数百バイトから数Kバイトの間で、効率の良いサイズをあらかじめ設定しておく。個々の単位ブロックのそれぞれの情報は、管理領域63に記憶される。静的メモリ管理においては、この単位ブロックを割り当て単位として管理を行い、アプリケーションプログラムから要求されたサイズを満たす単位ブロックの整数倍の領域が割り当てられる。
【0017】
図4は、静的メモリ管理における領域の割り当てについてのフローチャートである。領域の割り当て処理において、CPU4は、アプリケーションプログラムからの要求サイズに対して、単位ブロックがいくつ必要か計算し(S1)、計算された単位ブロック数を使用可能な空間DyAreaTop 67からMemStEnd64の中から検索し(S2)、空きブロックが見つかれば(S3でYES)、その空きブロックに関する管理領域63の管理情報を更新し(S4)、空きブロックの先頭アドレスをアプリケーションプログラムに返して(S5)、終了する。一方、S3において、十分な空きブロックが見つからなかった場合には(S3でNO)、動的メモリ管理に対して領域の整頓の要求を出す(S6)。
【0018】
S6における動的メモリ管理においては、割り当て済みの動的プログラムに使用している領域を、MemLoEnd61方向に移動して詰めて行くことにより、DyAreaTop 67がMemLoEnd61方向に移動し、その結果、DyAreaTop 67とStAreaBottom65の間の未割り当ての空き領域69が広がる。その未割り当て領域に十分な空きブロックがあれば(S7でYES)、その空きブロックに関する情報を更新し(S4)、見付かった空きブロックの先頭アドレスをアプリケーションプログラムに返して(S5)、終了する。S7において十分な空きブロックが見つからなかった場合には(S7でNO)、割り当て失敗となり、終了する。
【0019】
図5は、静的メモリ管理における割り当て済み領域のサイズ変更についてのフローチャートである。この処理においては、既に割り当て済みの領域のサイズをアプリケーションプログラムの要求に応じて変更する。要求サイズに応じて、単位ブロックがいくつ必要か計算し(S11)、今までの割り当て済みブロック数と今回の要求に対する必要ブロックサイズを比較し、割り当てブロックの拡大が必要か否かを調べる(S12)。S12で今回の要求サイズが今までの割り当てサイズよりも小さく、拡大の必要がないと判断されれば(S12でNO)、今までの割り当て済み領域を縮小し、それに伴い管理領域63の管理情報も更新し(S13)、終了する。
【0020】
一方、S12において拡大の必要があれば、今まで割り当てられていたブロックの前後のブロックの状況を検索し(S14)、今まで割り当てられていたブロックと前後の空きブロックで十分な領域が確保できるようであれば(S15でYES)、今まで割り当てられていたブロックと前後の空きブロックで必要なブロックを新しく割り当て(S16)、新しい割り当てに伴い管理領域63の管理情報を更新し(S17)、必要ならば今までのブロック内のデータを新しく割り当てられたブロックにコピーし(S18)、新しく割り当てられたブロックの先頭アドレスをアプリケーションプログラム側に返し(S19)、終了する。
【0021】
S15において、前後の空きブロックでは空き領域が不十分な場合(S15でNO)、十分な空きブロックを使用可能な空間DyAreaTop 67からMemStEnd64の中から検索し(S20)、新たに割り当て可能か否かを判断し(S21)、可能であれば(S21でYES)、その領域のブロックを新規に割り当てるブロックとして割り当て(S22)、今までのブロック内のデータを新しく割り当てられたブロックにコピーし(S23)、今までのブロック及び、新しいブロックの管理情報を更新し(S24)、新規に割り当てるブロックの先頭アドレスをアプリケーションプログラム側に返し(S25)、終了する。
【0022】
S21において、十分な空きブロックが無かった場合(S21でNO)、上述した図4のS6と同様に動的メモリ管理に対して領域の整頓の要求を出す(S26)。動的メモリ管理においては、割り当て済みの領域をMemLoEnd61方向に移動して、詰めて行くことにより、DyAreaTop 67がMemLoEnd61方向に移動して、その結果、DyAreaTop 67とStAreaBottom65の間の未割り当て領域が広がる。十分な空きブロックがあれば(S27でYES)、S22以降の処理に移る。S27において、十分な空きブロックが見つからなかった場合には(S27でNO)、サイズ変更失敗となり、終了する。
【0023】
図6は、静的メモリ管理における割り当て済み領域の開放についてのフローチャートである。この処理においては、アプリケーションプログラムから指示されたブロックを開放して空きブロックとし、管理領域63の管理情報等を更新し(S31)、終了する。
【0024】
動的メモリ管理について、図7から図10を用いて説明する。図7は、動的な属性に割り当てられている空間周辺を示したメモリ空間60の概念図である。動的メモリ管理ではメモリの下位アドレスから領域の割り当てを行う。動的メモリ管理において使用可能なメモリ空間は、メモリの下位アドレスMemLoEnd61から静的メモリ管理が使用している空間の下限を示すStAreaBottom65までである。動的メモリ管理で割り当てられた領域は、新たな空き領域の確保のために移動することがある。そのために、アプリケーションプログラム側では割り当てられた領域の先頭アドレスでは管理できない。そこで、割り当てられた領域の先頭アドレスを別の領域75に一度記憶しておき、アプリケーションプログラムからは、その記憶された領域を介して、割り当てられた領域の先頭アドレスを得る。割り当てられた領域の先頭アドレスをまとめて記憶しておく領域75をポインタ記憶領域と呼ぶ。ポインタ記憶領域75は、動的メモリ管理において移動の対象とならないように、静的メモリ管理で管理される領域に確保される。
【0025】
また、アプリケーションプログラムから要求されたサイズの領域が割り当てられるが、割り当てられる領域それぞれに、管理領域が付随している。図7には割り当て済みの一つの領域80を拡大しており、アプリケーションプログラムに対して割り当てられた領域80aの直前にこの領域80aを管理するための管理情報領域80bが付加されている。この管理情報領域80bには、領域80のサイズ、領域80の前後に存在する領域の先頭アドレス、それらの領域の割り当て済み・未割り当ての属性などが記憶されている。
【0026】
図8は、動的メモリ管理における領域の割り当てについてのフローチャートである。領域の割り当て処理において、アプリケーションプログラムからの要求サイズに対して、そのサイズと管理情報領域とを加えた大きさを満足する空き領域をMemLoEnd61からStAreaBottom65の間で検索し(S41)、十分な空き領域があれば(S42でYES)、その領域を割り当て、その領域に関する管理情報及びその領域の前後領域の管理情報を管理情報領域80bにて更新する(S43)。そして、割り当てる領域の先頭アドレスをポインタ記憶領域75に書き込み(S44)、ポインタ記憶領域75内の書き込まれたアドレスをアプリケーションプログラムに返して(S45)、終了する。
【0027】
一方、S42において、十分な空き領域が見つからなかった場合には(S42でNO)、動的メモリ管理によって管理されている領域(MemLoEnd61からDyAreaTop 67の間)の整頓を行う(S46)。すなわち、割り当て済みの領域をMemLoEnd61方向に移動して、詰めてゆくことにより、DyAreaTop 67がMemLoEnd61の方向に移動して、その結果、DyAreaTop 67とStAreaBottom65の間の未割り当ての空き領域69が広がり、その空き領域69に、十分な空き領域が存在すれば(S47でYES)、処理はS43に移る。十分な空き領域が存在しなければ(S47でNO)、割り当て失敗となり、終了する。
【0028】
図9は、動的メモリ管理における割り当て済み領域のサイズ変更についてのフローチャートである。この処理においては、既に割り当て済みの領域のサイズをアプリケーションプログラムの要求に応じて変更する。要求サイズと今までの割り当てサイズとを比較し(S51)、今回のサイズが今までよりも小さく、領域拡大の必要がなければ(S51でNO)、今までの割り当て済み領域を縮小し、それに伴い管理情報も更新し(S52)、終了する。
【0029】
S51において領域拡大の必要があれば(S51でYES)、今まで割り当てられていた領域の前後の領域の状況を検索し(S53)、今まで割り当てられていた領域と前後の空き領域で十分な領域が確保できるようであれば(S54でYES)、今まで割り当てられていた領域と前後の空き領域で必要な領域を新しく割り当て(S55)、新しい割り当てに伴い管理情報を更新し(S56)、今までの領域内のデータを新しく割り当てられた領域にコピーし(S57)、ポインタ記憶領域75に書き込まれていた割り当て領域の先頭アドレスを新しく割り当てる領域の先頭アドレスに書き換え(S58)、ポインタ記憶領域75に書き込まれたアドレスをアプリケーションプログラムに返し(S59)、終了する。
【0030】
S54において、十分な空き領域が無かった場合(S54でNO)、MemLoEnd61からStAreaBottom65の間で十分な空き領域を検索し(S60)、十分な空き領域があり、新たに割り当て可能であれば(S61でYES)、その領域を新規に割り当てる領域とし(S62)、今まで割り当てられていた領域の内部のデータを新しく割り当てる領域にコピーし(S63)、今まで割り当てられていた領域を未使用にし、新しく割り当てる領域の管理情報を更新し(S64)、ポインタ記憶領域75に書き込まれていた割り当て領域の先頭アドレスを新しく割り当てる領域の先頭アドレスに書き換え(S65)、ポインタ記憶領域75の書き込まれたアドレスをアプリケーションプログラムに返し(S66)、終了する。
【0031】
S61において、十分な空き領域が見つからなかった場合は(S61でNO)、上述した図8のS46と同様に動的メモリ管理によって管理している領域(MemLoEnd61からDyAreaTop 67の間)の整頓を行う(S67)。すなわち、割り当て済みの領域をMemLoEnd61方向に移動して、詰めていくことにより、DyAreaTop 67がMemLoEnd61方向に移動して、その結果、DyAreaTop 67とStAreaBottom65の間の未割り当て領域が広がる。その未割り当て領域に、十分な空き領域が存在すれば(S68でYES)、処理はS62に移る。十分な空き領域が存在しなければ(S68でNO)、割り当て失敗となり、終了する。
【0032】
図10は、動的メモリ管理における割り当て済み領域の開放についてのフローチャートである。この処理においては、アプリケーションプログラムから指示された領域を開放して空き領域とし、管理情報等を更新し(S71)、終了する。
【0033】
本実施例によるメモリ管理方法及び装置によれば、メモリ空間60を管理する際、静的メモリ管理はメモリ空間60の上位アドレスMemHiEnd62からMemLoEnd61へ向かう方向に静的な属性を持つ領域を割り当て(図4〜図6の処理)、動的メモリ管理はメモリ空間60の下位アドレスMemLoEnd61からMemHiEnd62へ向かう方向に動的な属性を持つ領域を割り当てる(図8〜図10の処理)ことにより2つの異なる属性の領域が分離され、メモリ空間60を有効に利用することができる。また、静的メモリ管理で管理される領域66は、一定のサイズのブロックに分割され、領域をこのブロックの整数倍として割り当てるようにしたことで、一定サイズ以下にメモリ空間60が細分化されることはなく、効率的なメモリ管理が行える。
【0034】
また、動的メモリ管理で管理される領域68の割り当ては、動的属性で割り当てられる領域の先頭アドレス情報をポインタ記憶領域75を介してアプリケーションプログラムに返すようにしているので(図8のS43〜S45、図9のS64〜S66及びS56〜S59、図10のS71)、動的属性を持つ領域のサイズ変更、他の動的属性を持つ領域の割り当て、他の動的属性を持つ領域のサイズ変更、静的メモリ管理からの領域の整頓要求が行われても、割り当て済み領域が自由にメモリ空間中を移動可能であるために、メモリ管理の自由度が大きく、メモリ使用の高効率化を図ることができ、適正にメモリ管理を行うことができる。
【0035】
なお、本発明は上記実施例構成に限られず種々の変形が可能である。例えば、上記実施例では、静的プログラム領域66は使い易いバイト数の単位ブロックに任意に分割しておくことで一層メモリ空間60を効率よく使用することができる。また、実施例では上位アドレスから下位アドレスへ向かう方向に静的メモリ管理による管理、下位アドレスから上位アドレスへ向かう方向に動的メモリ管理による管理を行うようにしたが、静的メモリ管理で下位アドレスから上位アドレスへ向かう方向に、動的メモリ管理で上位アドレスから下位アドレスへ向かう方向に領域を割り当てるようにしてもよい。
【0036】
【発明の効果】
以上のように請求項1又は2の発明に係るメモリ管理方法又は装置によれば、メモリ空間を静的属性を持つ領域と、動的属性を持つ領域とに分離し、静的属性を持つ領域を管理する静的メモリ管理はメモリ空間の一端から他端へ向かう方向に単位ブロックを単位として領域を割り当て、動的属性を持つ領域を管理する動的メモリ管理は他端から一端へ向かう方向に領域を割り当てる。そして、第1のメモリ管理方式又は手段は、新規割り当てあるいはサイズ変更を実行するために必要な空きブロックが無かった場合には第2のメモリ管理方式又は手段に対して領域の整頓の要求を出し、第2のメモリ管理方式又は手段は、第1のメモリ管理方式又は手段からの領域の整頓の要求に応じて割り当て済みの領域を前記他端側に詰めるように移動配置することにより、動的属性で割り当てられた領域間に静的属性で割り当てられた領域が存在することがなく、空き領域を広げて他の動的属性の領域の割り当てやサイズ変更が自在となり、従って、効率の良いメモリ管理が実現できる。しかも、メモリ空間を予め所定サイズの単位ブロックに分割しておき、アプリケーションプログラムに対して単位ブロックの整数倍で割り当て、割り当てられた領域の先頭アドレスを固定するようにしているので、不規則なサイズによるメモリ空間の細分化を防ぐことが可能となり、空き領域の確保が容易となり、メモリ空間を効率よく管理することができる。
【図面の簡単な説明】
【図1】本発明の一実施例によるメモリ管理方法が用いられるメモリ管理装置の概略構成を示すブロック図である。
【図2】本メモリ管理方法におけるメモリ空間の概念を示した図である。
【図3】本メモリ管理方法の静的属性を持つ領域の管理におけるメモリ空間の概念を示した図である。
【図4】静的属性を持つ領域の管理における領域の割り当て処理を示したフローチャートである。
【図5】静的属性を持つ領域の管理における割り当て済み領域のサイズ変更処理を示したフローチャートである。
【図6】静的属性を持つ領域の管理における割り当て済み領域の解放処理を示したフローチャートである。
【図7】本メモリ管理方法の動的属性を持つ領域の管理におけるメモリ空間の概念を示した図である。
【図8】動的属性を持つ領域の管理における領域の割り当て処理を示したフローチャートである。
【図9】動的属性を持つ領域の管理における割り当て済み領域のサイズ変更処理を示したフローチャートである。
【図10】動的属性を持つ領域の管理における割り当て済み領域の解放処理を示したフローチャートである。
【図11】従来のメモリ管理方法におけるメモリ空間の動きを示した概念図である。
【符号の説明】
3 プリンタコントローラ(メモリ管理装置)
4 CPU(制御装置)
5 ROM
6 RAM(メモリ)
60 メモリ空間
61 MemLoEnd(最下位アドレス)
62 MemHiEnd(最上位アドレス)
63 管理領域
66 静的なメモリ管理で使用されている領域
68 動的なメモリ管理で使用されている領域
75 ポインタ記憶領域
80b 管理情報領域
[0001]
[Industrial application fields]
The present invention relates to a memory management method and apparatus for managing a memory mounted on an information processing device such as a personal computer or a printer.
[0002]
[Prior art]
Conventionally, memory management in information processing devices such as personal computers and printers basically involves allocating a memory area corresponding to the program size requested by the application program, changing the size of the allocated area, and releasing the allocated area. Processing is performed in the memory space possessed.
[0003]
A conventional memory management method will be described with reference to FIGS. Here, a memory management method (hereinafter referred to as a dynamic memory management method, and the allocated area is referred to as an area having a dynamic attribute) capable of moving the allocated area in the memory space will be described. In a continuous memory area 100 of a memory such as a RAM allocated to the application program, as shown in FIG. 11A, areas D1, D2, D3, D4 (each size is set to SD1 in the order from the lower address to the higher address). , SD2, SD3, and SD4) have been allocated, and areas F1, F2, F3, F4, and F5 (each size being SF1, SF2, SF3, SF4, and SF5) are free. If there is an area allocation request of size SD5 from the application program, the size SD5 is compared with the sizes of the free areas F1 to F5 (SF1 to SF5). As a result, if the size SF4 of the area F4 is sufficient to secure the area of the size SD5, as shown in FIG. 11B, a program of the size SD5 is assigned to the area F4, this area is designated as D5, and the remainder of the area F4. The free space is F6 (size SF6 = SF4-SD5).
[0004]
However, the size SD5 of the area to be allocated is compared with the size of each of the free areas F1 to F4. If sufficient area is not found, the already allocated areas D1 to D4 are moved to the lower address side. Thus, as shown in FIG. 11 (c), a new empty area F7 (size SF7 = SF1 + SF2 + SF3 + SF4 + SF5) is created, and an area of size SD5 is allocated to the empty area F7. As shown in d), this is assumed to be D5, and the remaining free area by assigning D5 is assumed to be F8 (size SF8 = SF7-SD5).
[0005]
Further, when the size of the allocated area D2 in the state of FIG. 11A is expanded from SD2 to SD2L, for example, if SD2L> SD2 + SF3 and SD2L ≦ SD2 + SF3 + SF4, then FIG. As shown in FIG. 11F, an empty area F9 is created by moving the area D3 in the upper address direction, that is, the area D4 side. As shown in FIG. 11F, an area of size SD2L is newly created by expanding the area D2. assign. Further, in the case of SD2L> SD2 + SF1 + SF2 + SF3 + SF4 and SD2L> SD2 + SF1 + SF2 + SF3 + SF4 + SF5 in the state shown in FIG. 11 (a), first, FIG. 11 (g) As shown in FIG. 11 (h), the areas D1 and D2 are moved in the lower address direction, and the areas D3 and D4 are moved in the upper address direction, thereby creating a continuous free area F11. D2L, which is an enlarged version of D2, is newly allocated, and the free space remaining by allocating D2L is defined as F12. When the area D2 is released in the state of FIG. 11A, a new continuous free area F13 (size SF13 = SF2 + SD2 + SF3) is created as shown in FIG. 11I.
[0006]
[Problems to be solved by the invention]
However, in the conventional memory management method as described above, when all areas are allocated with a dynamic attribute that can be moved to the application program, a new memory management method is used until the total free area of the memory becomes zero. However, the allocated area may be allocated with a static attribute that cannot be moved in the memory space due to the efficiency of processing in the program. For example, as shown in FIG. 11A, the programs have already been assigned to the areas D1, D2, D3, and D4, and the areas F1, F2, F3, F4, and F5 are free. It is assumed that the area D3 is assigned with a static attribute that cannot be moved. At this time, if the request to increase the size of D2 from SD2 to SD2L is made, the area D3 cannot be moved despite SD2L> SD2 + SF1 + SF2 + SF3 + SF4 + SF5. The empty area F11 as shown in FIG. 11 (g) cannot be created. Therefore, it is impossible to increase the size of D2. That is, if an area having a static attribute that cannot be moved exists in the vicinity of the center of the memory space, a new memory allocation or a change in allocation size may not be possible even though there is a sufficient free area. In addition, due to the disadvantages described above, there have been problems that the frequency of movement of allocated programs increases, or that the stored programs are fragmented and the free space in the memory space cannot be used efficiently.
[0007]
The present invention has been made to solve the above-described problems, and in one continuous memory space, the allocation area to the memory space is separated by the difference in the static or dynamic allocation attribute of the area. Accordingly, it is an object of the present invention to provide a memory management method and apparatus capable of improving the use efficiency of the memory and efficiently allocating a new area of the memory free area and changing the size of the allocated area.
[0008]
[Means for Solving the Problems]
In order to achieve the above object, the memory management method of the invention of claim 1 is a memory management method capable of performing two memory managements in one continuous memory space. The memory space is managed in units of a predetermined size unit and is not relocated due to new allocation of other areas or size changes of other areas, and the size of the area allocated to the application program Is a first memory management method for performing static memory management set to an integral multiple of the unit block, and an area already allocated to the application program is a new allocation of another area or a size change of another area. Second memo that performs dynamic memory management that may be relocated with the move The first memory management method allocates an allocation area in units of the unit block from one end of the memory space, and the second memory management method allocates from the other end of the memory space. Area The first memory management method issues a request for ordering the area to the second memory management method when there is no free block necessary for executing new allocation or size change. The second memory management method is in response to a request for tidy area from the first memory management method. The allocated area is moved and arranged so as to close the other end side.
According to a second aspect of the present invention, there is provided a memory management device capable of managing two memories in one continuous memory space, wherein an area already allocated to an application program is newly allocated to another area. Alternatively, the memory space is not rearranged along with the size change of other areas, and the memory space is managed in units of a predetermined size unit, and the size of the area allocated to the application program is the size of the unit block. The first memory management means for performing static memory management set to an integral multiple and the area already allocated to the application program are moved and rearranged as new areas are newly allocated or other areas are resized. Second memory management means for performing dynamic memory management Said first memory management unit, the place allocated area from one end of the memory space in units of the unit block, the second memory management unit may allocate a region from the other end of the memory space The first memory management means issues a request for ordering the area to the second memory management means when there is no free block necessary for executing new allocation or size change, The second memory management means responds to an area order request from the first memory management means. The allocated area is moved and arranged so as to close the other end side.
[0009]
[Action]
In the memory management method or apparatus according to claim 1 or 2, the first memory management method or means for performing static memory management in response to a memory allocation request from an application program is a memory space The second memory management method or means for allocating the allocation area from one end to the unit block as a unit and performing dynamic memory management allocates the allocation area from the other end of the memory space. Deploy. The first memory management method or means issues a request for ordering the area to the second memory management method or means when there is no free block necessary for executing new allocation or size change. The second memory management method or means responds to the request for ordering the area from the first memory management method or means. The allocated area is moved and arranged so as to close the other end side. As a result, it is possible to efficiently allocate a new area of the memory free area and change the size of the allocated area, and the area size allocated to the application program is an integral multiple of the unit block. As a result, the subdivided areas are not scattered in the memory space and a large free area cannot be created, and the subdivision of the memory space is suppressed, the memory management can be performed efficiently, and the large free area can be saved. Can be secured.
[0010]
[0011]
【Example】
Hereinafter, an embodiment of the present invention will be described with reference to the drawings. FIG. 1 is a schematic block diagram when the memory management device of this embodiment is mounted on a printer controller. The memory management device is mounted on the printer controller 3 that processes a print command sent from the host computer 1 and transfers the processed print image to the printer engine 2. The memory management method according to the present invention is the entire printer controller 3. It is executed by the CPU 4 that controls the above. In addition to the CPU 4, the printer controller 3 includes a ROM 5 that stores a control program for controlling the printer engine 2 and font data, a RAM 6, and an input / output interface 7 that communicates with an external device such as the host computer 1. The printer engine interface 8 communicates with the printer engine 2 and the bus 9 interconnects them.
[0012]
In the memory management device configured as described above, the CPU 4 manages the memory area of the RAM 6 based on the memory management program included in the printer control program stored in the ROM 5, and in the memory space of the RAM 6 in response to a request from the printer control program. Allocate space. For example, an area as a reception buffer for temporarily storing print data sent from the host computer 1 or an area for storing intermediate data generated during processing of print data is assigned to the static attribute area to temporarily Font data stored (cached) is allocated to the dynamic attribute area.
[0013]
FIG. 2 is a diagram showing the concept of the storage area of the RAM 6 in FIG. The memory assumes a continuous memory space 60. In the memory space 60, the lowest address is MemLoEnd 61, the highest address is MemHiEnd 62, an area having a static attribute is assigned in the direction from the upper address to the lower address of the memory, and the lower address is directed to the higher address. Areas with dynamic attributes in the direction are allocated. Hereinafter, the former is called static memory management, and the latter is called dynamic memory management. In the illustrated memory space 60, the hatched area is an already allocated area, and the non-hatched part is an unallocated area.
[0014]
In static memory management, an area having a size required by an application program (in this embodiment, a printer control program) is allocated in order from the MemStEnd 62 toward the MemLoEnd 61. In the memory space 60, a management area 63 for static memory management is secured immediately before MemHiEnd 62, and immediately before the management area 63 is indicated by MemStEnd 64. An area 66 between MemStEnd64 and StAreaBottom 65 is an area used in static memory management. The address indicated by StAreaBottom 65 is the tip of the area allocated by static memory management, and StAreaBottom 65 moves by area allocation and release.
[0015]
In the dynamic memory management, an area having a size required by an application program is allocated in order from the MemLoEnd 61 toward the MemStEnd 64 direction. An area 68 between MemLoEnd 61 and DyAreaTop 67 is an area used in dynamic memory management. The address indicated by DyAreaTop 67 is the tip of the area allocated by dynamic memory management, and DyAreaTop 67 moves by area allocation and release. An area 69 of DyAreaTop 67 and StAreaBottom 65 is an unused free area that is not managed by either static or dynamic memory management.
[0016]
Next, basic functions of static memory management (area allocation, size change of allocated area, release of allocated area) will be described with reference to FIGS. FIG. 3 is a conceptual diagram of the memory space 60 showing the periphery of the space assigned to the static attribute. In static memory management, a usable space (MemLoEnd61 to MemStEnd64) is divided into a certain size. Each of these is called a unit block. As the size of the unit block, an efficient size is set in advance between several hundred bytes to several kilobytes. Information of each individual unit block is stored in the management area 63. In static memory management, management is performed using this unit block as an allocation unit, and an area that is an integral multiple of the unit block that satisfies the size requested by the application program is allocated.
[0017]
FIG. 4 is a flowchart of area allocation in static memory management. In the area allocation process, the CPU 4 calculates how many unit blocks are required for the requested size from the application program (S1), and searches the available number of unit blocks from the usable space DyAreaTop 67 in the MemStEnd64. If a free block is found (YES in S3), the management information in the management area 63 relating to the free block is updated (S4), the start address of the free block is returned to the application program (S5), and the process ends. . On the other hand, if a sufficient free block is not found in S3 (NO in S3), a request for ordering the area is issued to the dynamic memory management (S6).
[0018]
In the dynamic memory management in S6, DyAreaTop 67 moves in the direction of MemLoEnd61 by moving the area used for the allocated dynamic program in the direction of MemLoEnd61, and as a result, DyAreaTop 67 An unallocated empty area 69 between the StAreaBottoms 65 is expanded. If there are enough free blocks in the unallocated area (YES in S7), the information about the free block is updated (S4), the head address of the found free block is returned to the application program (S5), and the process ends. If sufficient free blocks are not found in S7 (NO in S7), the allocation fails and the process ends.
[0019]
FIG. 5 is a flowchart for changing the size of the allocated area in the static memory management. In this process, the size of the already allocated area is changed according to a request from the application program. The number of unit blocks required is calculated according to the requested size (S11), and the number of allocated blocks so far is compared with the required block size for the current request to check whether the allocated block needs to be expanded (S12). ). If it is determined in S12 that the current requested size is smaller than the current allocation size and there is no need for expansion (NO in S12), the allocated area so far is reduced, and the management information in the management area 63 is correspondingly reduced. Is also updated (S13), and the process ends.
[0020]
On the other hand, if there is a need for expansion in S12, the status of the blocks before and after the block allocated so far is searched (S14), and a sufficient area can be secured with the blocks allocated so far and the empty blocks before and after. If so (YES in S15), a necessary block is newly allocated (S16), and the management information in the management area 63 is updated with the new allocation (S17). If necessary, the data in the previous block is copied to the newly allocated block (S18), the head address of the newly allocated block is returned to the application program side (S19), and the process ends.
[0021]
In S15, if the empty area is insufficient in the preceding and succeeding empty blocks (NO in S15), a sufficient empty block is searched from the usable space DyAreaTop 67 in the MemStEnd 64 (S20), and whether or not new allocation is possible. (S21), if possible (YES in S21), the block in the area is assigned as a newly assigned block (S22), and the data in the previous block is copied to the newly assigned block (S23). ), The management information of the previous block and the new block is updated (S24), the head address of the block to be newly allocated is returned to the application program (S25), and the process is terminated.
[0022]
If there are not enough free blocks in S21 (NO in S21), a request for ordering of areas is issued to dynamic memory management in the same manner as S6 in FIG. 4 described above (S26). In the dynamic memory management, the allocated area is moved in the direction of MemLoEnd 61 and packed, so that DyAreaTop 67 is moved in the direction of MemLoEnd 61. As a result, the unallocated area between DyAreaTop 67 and StAreaBottom 65 is expanded. . If there are enough free blocks (YES in S27), the process proceeds to S22 and subsequent steps. In S27, if sufficient empty blocks are not found (NO in S27), the size change fails and the process ends.
[0023]
FIG. 6 is a flowchart for releasing an allocated area in static memory management. In this process, the block instructed by the application program is released to become a free block, the management information in the management area 63 is updated (S31), and the process is terminated.
[0024]
Dynamic memory management will be described with reference to FIGS. FIG. 7 is a conceptual diagram of the memory space 60 showing the periphery of the space assigned to the dynamic attribute. In dynamic memory management, an area is allocated from the lower address of the memory. The memory space that can be used in the dynamic memory management is from the memory lower address MemLoEnd 61 to StAreaBottom 65 that indicates the lower limit of the space used by the static memory management. An area allocated by dynamic memory management may move to secure a new free area. For this reason, the application program cannot manage the start address of the allocated area. Therefore, the start address of the allocated area is stored once in another area 75, and the start address of the allocated area is obtained from the application program via the stored area. An area 75 in which the top addresses of the allocated areas are stored together is called a pointer storage area. The pointer storage area 75 is secured in an area managed by static memory management so as not to be a movement target in dynamic memory management.
[0025]
An area having a size requested by the application program is allocated, and a management area is attached to each allocated area. In FIG. 7, one allocated area 80 is enlarged, and a management information area 80b for managing this area 80a is added immediately before the area 80a allocated to the application program. The management information area 80b stores the size of the area 80, the top addresses of areas existing before and after the area 80, the assigned / unassigned attributes of these areas, and the like.
[0026]
FIG. 8 is a flowchart of area allocation in dynamic memory management. In the area allocation process, a free area that satisfies the size obtained by adding the size and the management information area to the size requested from the application program is searched between MemLoEnd 61 and StAreaBottom 65 (S41), and a sufficient free area is obtained. If there is (YES in S42), the area is allocated, and the management information related to the area and the management information of the areas before and after the area are updated in the management information area 80b (S43). Then, the start address of the area to be allocated is written in the pointer storage area 75 (S44), the address written in the pointer storage area 75 is returned to the application program (S45), and the process ends.
[0027]
On the other hand, if a sufficient free area is not found in S42 (NO in S42), the area managed by dynamic memory management (between MemLoEnd 61 and DyAreaTop 67) is organized (S46). That is, by moving the allocated area in the direction of MemLoEnd 61 and filling the area, DyAreaTop 67 moves in the direction of MemLoEnd 61. If there is sufficient free space in the free space 69 (YES in S47), the process proceeds to S43. If there is not enough free space (NO in S47), the allocation fails and the process ends.
[0028]
FIG. 9 is a flowchart for changing the size of the allocated area in the dynamic memory management. In this process, the size of the already allocated area is changed according to a request from the application program. The requested size is compared with the allocated size so far (S51). If the current size is smaller than before and there is no need to expand the area (NO in S51), the allocated area so far is reduced. Accordingly, the management information is also updated (S52), and the process ends.
[0029]
If it is necessary to expand the area in S51 (YES in S51), the statuses of the areas before and after the allocated area are searched (S53), and the allocated area and the empty areas before and after the area are sufficient. If the area can be secured (YES in S54), a necessary area is newly allocated (S55) and the management information is updated with the new allocation (S56). Data in the previous area is copied to the newly allocated area (S57), and the start address of the allocated area written in the pointer storage area 75 is rewritten to the start address of the newly allocated area (S58), and the pointer storage area The address written in 75 is returned to the application program (S59), and the process ends.
[0030]
If there is not enough free space in S54 (NO in S54), search for sufficient free space between MemLoEnd 61 and StAreaBottom 65 (S60), and if there is enough free space and can be newly allocated (S61). YES), the area is set as a newly allocated area (S62), the data in the area allocated so far is copied to the newly allocated area (S63), the area allocated so far is unused, The management information of the newly allocated area is updated (S64), the start address of the allocated area written in the pointer storage area 75 is rewritten to the start address of the newly allocated area (S65), and the address written in the pointer storage area 75 is changed. It returns to the application program (S66) and ends.
[0031]
If a sufficient free area is not found in S61 (NO in S61), the area managed by dynamic memory management (between MemLoEnd 61 and DyAreaTop 67) is arranged in the same manner as S46 of FIG. 8 described above. (S67). That is, by moving the allocated area in the direction of MemLoEnd 61 and filling it, DyAreaTop 67 moves in the direction of MemLoEnd 61, and as a result, the unallocated area between DyAreaTop 67 and StAreaBottom 65 is expanded. If there is a sufficient free area in the unallocated area (YES in S68), the process proceeds to S62. If there is not enough free space (NO in S68), the allocation fails and the process ends.
[0032]
FIG. 10 is a flowchart for releasing an allocated area in dynamic memory management. In this process, the area instructed by the application program is released to become a free area, management information and the like are updated (S71), and the process ends.
[0033]
According to the memory management method and apparatus according to the present embodiment, when managing the memory space 60, the static memory management allocates an area having a static attribute in the direction from the upper address MemHiEnd 62 to the MemLoEnd 61 in the memory space 60 (see FIG. 4 to 6), the dynamic memory management assigns two different attributes by assigning an area having a dynamic attribute in the direction from the lower address MemLoEnd 61 to MemHiEnd 62 in the memory space 60 (process of FIGS. 8 to 10). Thus, the memory space 60 can be used effectively. Further, the area 66 managed by the static memory management is divided into blocks of a certain size, and the area is allocated as an integral multiple of this block, so that the memory space 60 is subdivided below the certain size. And efficient memory management.
[0034]
In addition, the allocation of the area 68 managed by the dynamic memory management is such that the top address information of the area allocated by the dynamic attribute is returned to the application program via the pointer storage area 75 (S43 in FIG. 8). S45, S64 to S66 and S56 to S59 in FIG. 9, S71 in FIG. 10, change of size of area having dynamic attributes, allocation of areas having other dynamic attributes, size of areas having other dynamic attributes Even when a change or static memory management request is made, the allocated area can be moved freely in the memory space, so the degree of freedom in memory management is great and the efficiency of memory use is increased. And memory management can be performed appropriately.
[0035]
In addition, this invention is not restricted to the said Example structure, A various deformation | transformation is possible. For example, in the above embodiment, the memory space 60 can be used more efficiently by arbitrarily dividing the static program area 66 into unit blocks each having an easy-to-use number of bytes. In the embodiment, the management by the static memory management is performed in the direction from the higher address to the lower address, and the management by the dynamic memory management is performed in the direction from the lower address to the higher address. The area may be allocated in the direction from the upper address to the lower address by dynamic memory management in the direction from the upper address to the upper address.
[0036]
【The invention's effect】
As described above, according to the memory management method or apparatus according to the first or second aspect of the present invention, the memory space is divided into the area having the static attribute and the area having the dynamic attribute, and the area having the static attribute. The static memory management that manages memory is allocated in units of unit blocks in the direction from one end to the other end of the memory space, and the dynamic memory management that manages areas with dynamic attributes is in the direction from the other end to the one end. Allocate space. And The first memory management method or means issues a request for ordering the area to the second memory management method or means when there is no free block necessary for executing new allocation or size change. The second memory management method or means responds to the request for ordering the area from the first memory management method or means. By allocating the allocated area so as to close to the other end side, there is no area allocated with the static attribute between the areas allocated with the dynamic attribute, and the free area can be expanded It is possible to freely allocate and change the size of the dynamic attribute area, thus realizing efficient memory management. In addition, the memory space is divided into unit blocks of a predetermined size in advance, assigned to the application program by an integer multiple of the unit block, and the start address of the allocated area is fixed, so the irregular size It is possible to prevent the memory space from being subdivided, and it becomes easy to secure a free space, and the memory space can be managed efficiently.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a schematic configuration of a memory management apparatus in which a memory management method according to an embodiment of the present invention is used.
FIG. 2 is a diagram showing a concept of a memory space in the present memory management method.
FIG. 3 is a diagram showing a concept of a memory space in management of an area having a static attribute in the present memory management method.
FIG. 4 is a flowchart showing area allocation processing in management of an area having a static attribute.
FIG. 5 is a flowchart showing a process for changing the size of an allocated area in the management of an area having a static attribute.
FIG. 6 is a flowchart showing a process for releasing an allocated area in management of an area having a static attribute.
FIG. 7 is a diagram showing a concept of a memory space in management of an area having a dynamic attribute in the present memory management method.
FIG. 8 is a flowchart showing area allocation processing in management of an area having a dynamic attribute.
FIG. 9 is a flowchart showing a process for changing the size of an allocated area in the management of an area having a dynamic attribute.
FIG. 10 is a flowchart showing a process for releasing an allocated area in management of an area having a dynamic attribute.
FIG. 11 is a conceptual diagram showing movement of a memory space in a conventional memory management method.
[Explanation of symbols]
3 Printer controller (memory management device)
4 CPU (control device)
5 ROM
6 RAM (memory)
60 memory space
61 MemLoEnd (lowest address)
62 MemHiEnd (highest address)
63 Management area
66 Area used for static memory management
68 Area used for dynamic memory management
75 Pointer storage area
80b Management information area

Claims (2)

一つの連続したメモリ空間において2つのメモリ管理を行うことができるメモリ管理方法において、
アプリケーションプログラムに対して割り当て済みの領域が他の領域の新規割り当てあるいは他の領域のサイズ変更に伴い再配置されることがなく、かつメモリ空間は予め定めたサイズの単位ブロックを単位として管理されると共に、アプリケーションプログラムに対して割り当てる領域のサイズは前記単位ブロックの整数倍に設定された静的なメモリ管理を行う第1のメモリ管理方式と、
アプリケーションプログラムに対して割り当て済みの領域が他の領域の新規割り当てあるいは他の領域のサイズ変更に伴い移動再配置されることがある動的なメモリ管理を行う第2のメモリ管理方式とを備え、
前記第1のメモリ管理方式は、前記メモリ空間の一端から前記単位ブロックを単位として割り当て領域を配置し、前記第2のメモリ管理方式は、前記メモリ空間の他端から割り当て領域を配置し、
前記第1のメモリ管理方式は、新規割り当てあるいはサイズ変更を実行するために必要な空きブロックが無かった場合には前記第2のメモリ管理方式に対して領域の整頓の要求を出し、前記第2のメモリ管理方式は、前記第1のメモリ管理方式からの領域の整頓の要求に応じて割り当て済みの領域を前記他端側に詰めるように移動配置することを特徴とするメモリ管理方法。
In a memory management method capable of managing two memories in one continuous memory space,
The area allocated to the application program is not rearranged when a new area is newly allocated or the size of the other area is changed, and the memory space is managed in units of unit blocks of a predetermined size. In addition, a first memory management method for performing static memory management in which the size of the area allocated to the application program is set to an integral multiple of the unit block;
A second memory management method for performing dynamic memory management in which an area allocated to an application program may be moved and rearranged in accordance with a new allocation of another area or a size change of another area;
The first memory management method arranges an allocation area in units of the unit block from one end of the memory space, and the second memory management method arranges an allocation area from the other end of the memory space ,
In the first memory management method, when there is no free block necessary for executing new allocation or size change, the second memory management method issues a request for arranging the area to the second memory management method. In this memory management method, the allocated area is moved and arranged so as to be narrowed to the other end side in response to a request for ordering of areas from the first memory management system .
一つの連続したメモリ空間において2つのメモリ管理を行うことができるメモリ管理装置において、
アプリケーションプログラムに対して割り当て済みの領域が他の領域の新規割り当てあるいは他の領域のサイズ変更に伴い再配置されることがなく、かつメモリ空間は予め定めたサイズの単位ブロックを単位として管理されると共に、アプリケーションプログラムに対して割り当てる領域のサイズは前記単位ブロックの整数倍に設定された静的なメモリ管理を行う第1のメモリ管理手段と、
アプリケーションプログラムに対して割り当て済みの領域が他の領域の新規割り当てあるいは他の領域のサイズ変更に伴い移動再配置されることがある動的なメモリ管理を行う第2のメモリ管理手段とを備え、
前記第1のメモリ管理手段は、前記メモリ空間の一端から前記単位ブロックを単位として割り当て領域を配置し、前記第2のメモリ管理手段は、前記メモリ空間の他端から割り当て領域を配置し、
前記第1のメモリ管理手段は、新規割り当てあるいはサイズ変更を実行するために必要な空きブロックが無かった場合には前記第2のメモリ管理手段に対して領域の整頓の要求を出し、前記第2のメモリ管理手段は、前記第1のメモリ管理手段からの領域の整頓の要求に応じて割り当て済みの領域を前記他端側に詰めるように移動配置することを特徴とするメモリ管理装置。
In a memory management device capable of managing two memories in one continuous memory space,
The area allocated to the application program is not rearranged when a new allocation of another area or a size change of another area is performed, and the memory space is managed in units of a unit block of a predetermined size. And first memory management means for performing static memory management in which the size of the area allocated to the application program is set to an integral multiple of the unit block;
A second memory management means for performing dynamic memory management in which an area allocated to an application program may be moved and rearranged in accordance with a new allocation of another area or a size change of another area;
The first memory management means arranges an allocation area in units of the unit block from one end of the memory space, and the second memory management means arranges an allocation area from the other end of the memory space ,
The first memory management means issues a request for ordering the area to the second memory management means when there is no free block necessary for executing new allocation or size change, and the second memory management means. The memory management unit is configured to move and arrange the allocated areas so as to close to the other end side in response to a request for ordering the areas from the first memory management means .
JP02878695A 1995-01-24 1995-01-24 Memory management method and apparatus Expired - Fee Related JP3610528B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP02878695A JP3610528B2 (en) 1995-01-24 1995-01-24 Memory management method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP02878695A JP3610528B2 (en) 1995-01-24 1995-01-24 Memory management method and apparatus

Publications (2)

Publication Number Publication Date
JPH08202611A JPH08202611A (en) 1996-08-09
JP3610528B2 true JP3610528B2 (en) 2005-01-12

Family

ID=12258117

Family Applications (1)

Application Number Title Priority Date Filing Date
JP02878695A Expired - Fee Related JP3610528B2 (en) 1995-01-24 1995-01-24 Memory management method and apparatus

Country Status (1)

Country Link
JP (1) JP3610528B2 (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100453964B1 (en) * 2001-12-28 2004-10-20 엘지전자 주식회사 Apparatus and method for operating memory
JP3864337B2 (en) * 2002-12-27 2006-12-27 富士通株式会社 How to upgrade
US8854680B2 (en) 2008-09-11 2014-10-07 Konica Minolta Laboratory U.S.A., Inc. Systems and methods for optimal memory allocation units
US8861014B2 (en) 2008-09-30 2014-10-14 Konica Minolta Laboratory U.S.A., Inc. Systems and methods for optimized printer throughput in a multi-core environment
JP5420972B2 (en) * 2009-05-25 2014-02-19 株式会社東芝 Memory management device
JP5381624B2 (en) * 2009-11-04 2014-01-08 富士通株式会社 Program and apparatus having memory management function
CN105653464B (en) * 2014-11-13 2024-05-07 紫光同芯微电子有限公司 Structure of JAVA intelligent card and object management method thereof
CN111666177B (en) * 2020-05-07 2023-06-30 中国石油天然气股份有限公司 A gas-liquid two-phase flowmeter instrument data storage method
EP4141671A4 (en) * 2020-05-22 2023-05-24 Huawei Technologies Co., Ltd. METHOD AND DEVICE FOR DYNAMIC MANAGEMENT FOR A SHARED MEMORY POOL
CN113485832B (en) * 2021-07-09 2024-07-02 支付宝(杭州)信息技术有限公司 Method and device for carrying out distribution management on physical memory pool and physical memory pool

Also Published As

Publication number Publication date
JPH08202611A (en) 1996-08-09

Similar Documents

Publication Publication Date Title
US5548740A (en) Information processor efficiently using a plurality of storage devices having different access speeds and a method of operation thereof
KR100724438B1 (en) Memory controller of base station modem
JP3610528B2 (en) Memory management method and apparatus
US5537635A (en) Method and system for assignment of reclaim vectors in a partitioned cache with a virtual minimum partition size
US8838929B2 (en) Allocation and deallocation of bounded time relative portions of a graphics memory
JPH0954723A (en) Method and device for forming virtual memory of off-screen memory in graphic engine
GB2256513A (en) Dynamically relocating main storage to virtual machine
KR100939649B1 (en) Buffer partitioning method and device without data loss
JP2005537557A (en) Dynamic memory management
US5640597A (en) Method and apparatus for servicing simultaneously a plurality of requests for data streams
JP6696052B2 (en) Storage device and storage area management method
JP4758794B2 (en) Memory area allocation control device, memory area allocation control program, and memory area allocation control method
JP4033829B2 (en) Memory management system
JP2002351739A (en) Memory management method and data processing device
KR20030071299A (en) Apparatus for managing memory
JPH0869403A (en) File management device
JP2008226082A (en) Data compression/decompression device, program for making computer execute, and data compression/decompression method
KR20000061779A (en) Method for managing sub-allocator of a memory
JPH0212339A (en) Table controller
KR19990019417A (en) Memory Management
JP3536362B2 (en) Drawing data generation method
JPH0869399A (en) File management device
JP2005050010A (en) Memory management method
JPH05100941A (en) Managing method for memory area
JPH0659946A (en) Storage area managing system having dynamic rearrangement function

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040810

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20041008

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20071029

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081029

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091029

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091029

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101029

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101029

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111029

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111029

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121029

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20131029

Year of fee payment: 9

LAPS Cancellation because of no payment of annual fees