JP5684633B2 - Memory management device, memory management method, and memory management program - Google Patents
Memory management device, memory management method, and memory management program Download PDFInfo
- Publication number
- JP5684633B2 JP5684633B2 JP2011083620A JP2011083620A JP5684633B2 JP 5684633 B2 JP5684633 B2 JP 5684633B2 JP 2011083620 A JP2011083620 A JP 2011083620A JP 2011083620 A JP2011083620 A JP 2011083620A JP 5684633 B2 JP5684633 B2 JP 5684633B2
- Authority
- JP
- Japan
- Prior art keywords
- bundle
- memory
- heap
- function
- bundle group
- 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
Links
Images
Description
本発明は、OSGi標準仕様に基づくバンドルが利用するメモリを管理する技術に関する。 The present invention relates to a technique for managing a memory used by a bundle based on an OSGi standard specification.
〔OSGiについて〕
OSGiは、ソフトウェアのモジュール化技術である。OSGi標準仕様に基づくソフトウェアモジュールは、バンドルと呼ばれている。
[About OSGi]
OSGi is a software modularization technology. A software module based on the OSGi standard specification is called a bundle.
システムアーキテクチャとしては、図18に示すように、動作端末のOS(Operating System)上でJava(登録商標)VM(Java Virtual Machine:Java仮想マシン)が1つのプロセスとして動作し、JavaVM上でバンドルの実行環境であるOSGiFW(OSGi Framework)が動作する。このOSGiFW上で複数のバンドルを動作させることができる。OSGiFWおよびバンドルは、Javaプログラムである。 As a system architecture, as shown in FIG. 18, a Java (registered trademark) VM (Java Virtual Machine) operates as one process on an OS (Operating System) of an operating terminal, and bundles are created on the Java VM. OSGiFW (OSGi Framework), which is an execution environment, operates. A plurality of bundles can be operated on the OSGiFW. OSGiFW and bundles are Java programs.
JavaプログラムをJavaVM上で動作させるには、まず、Java言語で書かれたソースコードを、JavaVMが解釈できるバイナリファイルであるクラスファイルにコンパイルする。JavaVMは、そのクラスファイルを解釈し、プログラムを実行する。 To run a Java program on JavaVM, first, source code written in the Java language is compiled into a class file that is a binary file that can be interpreted by JavaVM. JavaVM interprets the class file and executes the program.
バンドルは、クラスファイルや画像ファイル等のプログラムの実行に必要なファイルの集合である。OSGi仕様では、複数のバンドルが連携する仕組み、つまり、あるバンドルが提供するクラスファイルを別のバンドルが呼び出すことができる仕組みを定めている。 A bundle is a set of files necessary for executing a program such as a class file or an image file. The OSGi specification defines a mechanism in which a plurality of bundles cooperate, that is, a mechanism in which another bundle can call a class file provided by a bundle.
その1つがOSGiサービスによる連携である。具体的には、図19に示すように、バンドルAが、Javaインターフェイスで定義されるサービスSの実装クラスを提供し、生成したオブジェクトをOSGiサービスとしてOSGiFWのサービスレジストリに登録する。 One of them is cooperation by OSGi service. Specifically, as shown in FIG. 19, the bundle A provides an implementation class of the service S defined by the Java interface, and registers the generated object as an OSGi service in the OSGiFW service registry.
バンドルBは、サービスレジストリに登録されている当該OSGiサービスを取得し、そのオブジェクトが持つサービスSのメソッドを呼び出すことができる。 The bundle B can acquire the OSGi service registered in the service registry and call the service S method of the object.
その他、パッケージのImport・Exportによる連携などがある。 In addition, there is cooperation by Import / Export of packages.
〔機能の提供・利用について〕
多くのOSGiサービスは、図20に示すように、OSGiサービスを登録したバンドルCが、サービスSを通じてバンドルDに機能を提供する形態である。
[Providing and using functions]
In many OSGi services, as shown in FIG. 20, the bundle C in which the OSGi service is registered provides a function for the bundle D through the service S.
例えば、OSGi仕様で定められたHttpServiceでは、バンドルCがHttpServiceの実装クラスを提供してサービス登録することにより、HTTPサーバへのJavaServlet登録機能などを他のバンドルに提供する。バンドルDは、HttpServiceを取得し、呼び出すことにより、バンドルCが提供するクラスのHttpServiceの機能を利用する。 For example, in the HTTP Service defined by the OSGi specification, the bundle C provides an HTTP Service implementation class and performs service registration, thereby providing a Java Servlet registration function to an HTTP server to other bundles. The bundle D obtains and calls the HttpService to use the HttpService function of the class provided by the bundle C.
一方、コールバック型の呼び出しの場合、機能の提供と利用が逆になる。例として、図21に示すように、ある情報を管理するバンドルEと、その情報が変更された時点で通知して欲しいバンドルFが存在する場合における、イベント通知が挙げられる。 On the other hand, in the case of a callback type call, the provision and use of functions are reversed. As an example, as shown in FIG. 21, there is an event notification when there is a bundle E that manages certain information and a bundle F that is desired to be notified when the information is changed.
この場合、バンドルFが、イベントリスナLとなるOSGiサービスの実装クラスを提供してサービスレジストリにサービス登録し、バンドルEがイベント通知すべきタイミングになると、登録された当該OSGiサービスを取得してコールバックする。 In this case, the bundle F provides the OSGi service implementation class that becomes the event listener L, registers the service in the service registry, and when the bundle E is to notify the event, obtains the registered OSGi service and calls it. Back.
つまり、イベント通知という機能を提供するのは呼び出しを行うバンドルEであり、クラスを提供するバンドルFはその機能を利用していることになる。 That is, a function called event notification is provided by a bundle E that performs a call, and a bundle F that provides a class uses the function.
このような機能の提供・利用の関係は、バンドル同士の連携以外にも、バンドルとOSGiFW、バンドルとJavaVMなどにもある。 The relationship between the provision and use of such functions also exists in bundles and OSGiFW, bundles and JavaVM, etc., in addition to cooperation between bundles.
〔JavaVMについて〕
従来の技術では、バンドル・OSGiFW・JavaVM自体が動作するために必要なメモリは、JavaVMが、OSから割り当てられた1つのヒープメモリ(ヒープ領域)から確保する。具体的には、例えば、あるスレッドで呼び出されたバンドルが利用(確保・消費)するメモリは、1つのヒープ領域から確保される。以下、メモリ割当という表現で説明する場合もある。
[About JavaVM]
In the conventional technology, the memory required for the bundle, OSGiFW, and JavaVM itself to operate is secured by the JavaVM from one heap memory (heap area) allocated from the OS. Specifically, for example, a memory used (secured / consumed) by a bundle called by a certain thread is secured from one heap area. Hereinafter, it may be described by the expression of memory allocation.
また、JavaVM上で動作するスレッドにおいて、メモリ割当は、図22に示すように、常に、最後に呼び出される各スレッドの一番上のスタック(TOPSTACK)で発生する。システムのEntityであるバンドル・OSGiFW・JavaVMは、1つのヒープメモリを共有する。 Further, in a thread operating on JavaVM, memory allocation always occurs in the top stack (TOPSTACK) of each thread called last, as shown in FIG. The bundle of the system, OSGiFW, and JavaVM, share one heap memory.
メモリ割当時に必要なメモリ量が確保できないとGC(Garbage Collection)が行われ、その時点で参照されていないオブジェクトのメモリ領域は解放される。GCが行われても必要なメモリ量が確保できない場合には、OOM(Out Of Memory)エラーが発生する。OOMエラーを捕捉し、対処する処理が各Entityで適切にされていない場合、そのEntityは動作をしなくなる可能性がある。 If the memory amount necessary for memory allocation cannot be secured, GC (Garbage Collection) is performed, and the memory area of the object that is not referenced at that time is released. If the required amount of memory cannot be secured even after GC, an OOM (Out Of Memory) error occurs. If an OOM error is caught and handled, the entity may fail to operate if it is not appropriate for each entity.
本発明では、「必要なメモリ量が確保できない場合」とは、GCが行われても必要なメモリ量が確保できない場合を指す。 In the present invention, “the case where the necessary amount of memory cannot be secured” refers to the case where the necessary amount of memory cannot be secured even when GC is performed.
また、図23に示すように、JavaVMのスタック構造は、一般的に、(1)呼び出し元スタックによる呼び出しが契機になり、(2)クラス提供スタック内の処理においてメモリ割当が行われる。本発明では、スタックにて行われる処理のクラスを実装クラス、そのクラスのクラスローダを実装クラスローダと定義する。 As shown in FIG. 23, the JavaVM stack structure is generally (1) triggered by a call from the caller stack, and (2) memory allocation is performed in the processing in the class providing stack. In the present invention, a class of processing performed in the stack is defined as an implementation class, and a class loader of the class is defined as an implementation class loader.
従来の技術では、バンドル・OSGiFW・JavaVMがヒープ領域を共有するため、あるEntityでOOMエラーが発生してメモリが解放されない場合、その他のEntityもその時点以降、新たにメモリを確保することができなくなり、結果的に全てのシステムが停止してしまう可能性がある。 In the conventional technology, the bundle, OSGiFW, and JavaVM share the heap area. If an OOM error occurs at a certain entity and the memory is not released, other entities can also secure new memory after that point. As a result, all the systems may stop.
特に課題となるのは、複数の事業者が従来の技術を用いて、1つのシステムを共有して同時にサービスを提供するような場合である。 A particular problem arises when a plurality of business operators share a single system and provide services simultaneously using conventional technology.
例えば、プラットフォーム事業者(以下、PF事業者)は、JavaVMやOSGiFWなどのシステムの基盤となる部分をプラットフォームシステムとして提供し、サービス事業者(以下、SP事業者)は、自身が開発したバンドルをPF事業者が提供するプラットフォームシステム上で動作させることでサービスを提供することを想定する。 For example, a platform provider (hereinafter referred to as a PF provider) provides a platform system part such as JavaVM or OSGiFW, and a service provider (hereinafter referred to as an SP provider) provides a bundle developed by itself. Assume that a service is provided by operating on a platform system provided by a PF company.
この時、あるSP事業者の作成するバンドルがバグ等により想定以上のメモリを消費すると、バグがなければ正常に動作可能であったはずの他のEntityまで動作できなくなってしまう。他のEntityとは、JavaVM,OSGiFW,他のバンドル等である。 At this time, if a bundle created by a certain SP provider consumes more memory than expected due to a bug or the like, it will not be able to operate until another Entity that should have been able to operate normally without the bug. Other entities are JavaVM, OSGiFW, other bundles, and the like.
つまり、正常な動作をしているはずのJavaVM上で動作する全てのEntity(PF事業者の提供するシステムやSP事業者のバンドル)が、1つのSP事業者のバンドルのバグによって動作不能になることが発生する。 In other words, all the entities (systems provided by PF providers and SP provider bundles) that operate on JavaVM that should be operating normally become inoperable due to a bug in one SP provider bundle. It happens.
また、前述したように、OSGiにおいてはバンドルやOSGiFWなどの構成要素が連携している。連携した時に消費されるメモリは、「呼び出し元」と「クラス提供」とのどちらのメモリ消費量としてカウントするかといった定義は、OSGiやJavaの仕様では定められていない(非特許文献1,非特許文献2参照)。定義が決まっていないため、バンドルのメモリ消費量の計測もできない。
As described above, in OSGi, components such as a bundle and OSGiFW are linked. The definition of whether the memory consumed when linking is counted as “caller” or “provided by class” is not defined in the specifications of OSGi or Java (Non-patent
本発明は、上記課題を鑑みてなされたものであり、その課題とするところは、メモリ消費量を任意の単位で制限することにある。 The present invention has been made in view of the above-mentioned problems, and the object of the present invention is to limit the memory consumption in an arbitrary unit.
請求項1記載のメモリ管理装置は、OSGi標準仕様に基づくバンドルが利用するメモリを管理するメモリ管理装置において、1以上のバンドルを有するバンドル群に利用が許可されたメモリ量の情報を記憶手段から読み出して、当該メモリ量と同じ大きさのヒープ領域を確保する要求を行うメモリ管理バンドルと、自機のヒープ領域から前記ヒープ領域を確保し、前記バンドル群が利用するメモリ領域を、当該ヒープ領域に割り当てるJava仮想マシンと、を有し、前記バンドル群を複数備え、当該複数のバンドル群は、あるスレッドにおいて呼び出し・呼び出される関係を有し、前記メモリ管理バンドルは、最初に呼び出しを行ったバンドル群のみについて前記要求を行い、当該バンドル群以外のバンドル群については前記要求を行わず、前記Java仮想マシンは、全てのバンドル群が利用するメモリ領域を、最初に呼び出しを行ったバンドル群に対して確保されたヒープ領域に割り当てることを特徴とする。
The memory management device according to
本発明によれば、バンドル群が利用するメモリ領域を、当該バンドル群に利用が許可されたメモリ量と同じ大きさで確保されたヒープ領域に割り当てるため、バンドル群が消費するメモリ消費量を任意の単位で制限できる。 According to the present invention, since the memory area used by the bundle group is allocated to the heap area secured with the same size as the amount of memory permitted to be used by the bundle group, the memory consumption amount consumed by the bundle group is arbitrary. Can be limited in units.
請求項2記載のメモリ管理装置は、OSGi標準仕様に基づくバンドルが利用するメモリを管理するメモリ管理装置において、1以上のバンドルを有するバンドル群に利用が許可されたメモリ量の情報を記憶手段から読み出して、当該メモリ量と同じ大きさのヒープ領域を確保する要求を行うメモリ管理バンドルと、自機のヒープ領域から前記ヒープ領域を確保し、前記バンドル群が利用するメモリ領域を、当該ヒープ領域に割り当てるJava仮想マシンと、を有し、前記バンドル群を複数備え、当該複数のバンドル群は、あるスレッドにおいてバンドルの有する機能の提供・利用の関係を有する機能提供バンドル群および機能利用バンドル群であって、前記メモリ管理バンドルは、前記機能利用バンドル群のみについて前記要求を行い、前記機能提供バンドル群については前記要求を行わず、前記Java仮想マシンは、前記機能提供バンドル群が利用するメモリ領域を、前記機能利用バンドル群に対して確保されたヒープ領域に割り当てることを特徴とする。
The memory management device according to
請求項3記載のメモリ管理方法は、OSGi標準仕様に基づくバンドルが利用するメモリを管理するメモリ管理方法において、コンピュータにより、1以上のバンドルを有するバンドル群に利用が許可されたメモリ量の情報を記憶手段から読み出して、当該メモリ量と同じ大きさのヒープ領域を確保する要求を行う第1ステップと、自機のヒープ領域から前記ヒープ領域を確保し、前記バンドル群が利用するメモリ領域を、当該ヒープ領域に割り当てる第2ステップと、を有し、前記バンドル群を複数備え、当該複数のバンドル群は、あるスレッドにおいて呼び出し・呼び出される関係を有し、前記第1ステップは、最初に呼び出しを行ったバンドル群のみについて前記要求を行い、当該バンドル群以外のバンドル群については前記要求を行わず、前記第2ステップは、全てのバンドル群が利用するメモリ領域を、最初に呼び出しを行ったバンドル群に対して確保されたヒープ領域に割り当てることを特徴とする。
The memory management method according to
本発明によれば、全てのバンドル群が利用するメモリ領域を、最初に呼び出しを行ったバンドル群に対して確保されたヒープ領域に割り当てるため、メモリ消費量をスレッド単位でカウントでき、当該カウント方法によってメモリ消費量を制限できる。 According to the present invention, since the memory area used by all bundle groups is allocated to the heap area reserved for the bundle group that is first called, the memory consumption can be counted in units of threads. Can limit memory consumption.
請求項4記載のメモリ管理方法は、OSGi標準仕様に基づくバンドルが利用するメモリを管理するメモリ管理方法において、コンピュータにより、1以上のバンドルを有するバンドル群に利用が許可されたメモリ量の情報を記憶手段から読み出して、当該メモリ量と同じ大きさのヒープ領域を確保する要求を行う第1ステップと、自機のヒープ領域から前記ヒープ領域を確保し、前記バンドル群が利用するメモリ領域を、当該ヒープ領域に割り当てる第2ステップと、を有し、前記バンドル群を複数備え、当該複数のバンドル群は、あるスレッドにおいてバンドルの有する機能の提供・利用の関係を有する機能提供バンドル群および機能利用バンドル群であって、前記第1ステップは、前記機能利用バンドル群のみについて前記要求を行い、前記機能提供バンドル群については前記要求を行わず、前記第2ステップは、前記機能提供バンドル群が利用するメモリ領域を、前記機能利用バンドル群に対して確保されたヒープ領域に割り当てることを特徴とする。
5. The memory management method according to
本発明によれば、機能提供バンドル群が利用するメモリ領域を、機能利用バンドル群に対して確保されたヒープ領域に割り当てるため、メモリ消費量を機能利用バンドル群単位でカウントでき、当該カウント方法によってメモリ消費量を制限できる。 According to the present invention, since the memory area used by the function providing bundle group is allocated to the heap area reserved for the function using bundle group, the memory consumption can be counted in units of function using bundle groups. Memory consumption can be limited.
請求項5記載のメモリ管理方法は、請求項4記載のメモリ管理方法において、前記機能提供バンドル群は、機能を提供するプラットフォーム事業者により生成されたバンドル群であり、前記機能利用バンドル群は、機能を利用するサービス事業者により生成されたバンドル群である、又は、前記機能提供バンドル群は、機能を提供するサービス事業者により生成されたバンドル群であり、前記機能利用バンドル群は、機能を利用するサービス事業者により生成されたバンドル群であることを特徴とする。
The memory management method according to
請求項6記載のメモリ管理方法は、請求項3乃至5のいずれかに記載のメモリ管理方法において、前記ヒープ領域で使用されているメモリ消費量を計算するステップを更に有する。 A memory management method according to a sixth aspect further includes a step of calculating a memory consumption amount used in the heap area in the memory management method according to any one of the third to fifth aspects.
本発明によれば、請求項3乃至5のいずれかに記載されたヒープ領域で使用されているメモリ消費量を計算するため、制限対象毎にメモリ消費量を計測できる。
According to the present invention, since the memory consumption used in the heap area described in any one of
請求項7記載のメモリ管理プログラムは、請求項3乃至6のいずれかに記載の各ステップをコンピュータに実行させることを特徴とする。 According to a seventh aspect of the present invention, there is provided a memory management program that causes a computer to execute the steps according to any of the third to sixth aspects.
本発明によれば、メモリ消費量を任意の単位で制限することができる。 According to the present invention, the memory consumption can be limited in an arbitrary unit.
以下、本発明を実施する一実施の形態について図面を用いて説明する。但し、本発明は多くの異なる様態で実施することが可能であり、本実施の形態の記載内容に限定して解釈すべきではない。 Hereinafter, an embodiment for carrying out the present invention will be described with reference to the drawings. However, the present invention can be implemented in many different modes and should not be construed as being limited to the description of the present embodiment.
〔メモリ管理装置の構成について〕
まず、メモリ管理装置1の構成について説明する。
[Configuration of memory management device]
First, the configuration of the
図1は、本実施の形態に係るメモリ管理装置の構成を示す図である。このメモリ管理装置1は、OSGi標準仕様に基づくバンドルが利用(確保・消費)するメモリを管理する装置であって、OS上で動作するJavaVM10と、JavaVM上でバンドルの実行環境を提供するOSGiFW11と、OSGiFW上でJavaプログラムとして動作する複数のオーナーバンドル12および複数のSPバンドルセット13とで主に構成される。
FIG. 1 is a diagram showing a configuration of a memory management device according to the present embodiment. The
なお、図2に示すように、PF事業者が作成するバンドルをオーナーバンドル12とし、SP事業者がサービスを提供するために作成するバンドルをSPバンドル131とする。
As shown in FIG. 2, a bundle created by the PF provider is referred to as an owner bundle 12, and a bundle created by the SP provider for providing a service is referred to as an
また、1以上のバンドルで構成されるバンドル群をバンドルセットとし、SP事業者が作成するSPバンドル群をSPバンドルセット13、PF事業者がプラットフォームシステムとして作成するJavaVM10とOSGiFW11とオーナーバンドル12とをPFセット14とする。PFセット14は本実施の形態において1つであり、SPバンドルセット13は複数考えられる。
Further, a bundle group composed of one or more bundles is used as a bundle set, an SP bundle group created by an SP provider is an SP bundle set 13, and a
JavaVM10には、従来技術にない標準外の機能を備えている(図1の改造部等参照)。また、JavaVM10に独自のAPIを持たせ、JavaVM10に所定の情報(後述)を設定するために、メモリ管理バンドル12aをオーナーバンドル12の1つとして用意する。
The
メモリ管理バンドル12aは、1つのバンドルセットを構成するバンドルの情報(以下、バンドルセット情報)と、そのバンドルセットに利用許可されるメモリ量(以下、バンドルセットメモリ量)との情報を、通信ネットワークを介して接続されたサーバ3等から取得して記憶手段に一旦記憶し、当該記憶手段から読み出して取得する機能を有する。
The memory management bundle 12a transmits information on information of bundles constituting one bundle set (hereinafter referred to as bundle set information) and the amount of memory permitted to be used for the bundle set (hereinafter referred to as bundle set memory amount) to a communication network. It has a function of acquiring from the
ここで、バンドルセット情報とは、OSGi仕様で定められるBundle−SymbolicNameとBundle−Versionとによってバンドルを一意に識別した識別子であり、識別したバンドルが1つ以上指定される。 Here, the bundle set information is an identifier that uniquely identifies the bundle by the Bundle-SymbolName and Bundle-Version defined by the OSGi specification, and one or more identified bundles are designated.
なお、サーバ3は、図3に示すように、メモリ管理装置1とは別装置として外部に設置されており、メモリ管理装置1と通信を行う。バンドルセット情報等の受け渡しはXMLファイル等の様々な方法が考えられる。なお、バンドルセット情報等については、サーバ3と通信を行い取得するのではなく、自機の記憶手段に予め保持しておき読み出すのでもよい。
As shown in FIG. 3, the
また、メモリ管理バンドル12aは、バンドルセット情報およびバンドルセットメモリ量を取得した後、JavaVM10が提供する第1API(後述)を通じて、JavaVM10に対して、取得したバンドルセットメモリ量と同じ大きさの分割ヒープ領域を生成する要求を行い、生成された分割ヒープ領域を識別するID(以下、ヒープID)を取得する機能を有する。
In addition, the memory management bundle 12a acquires bundle set information and a bundle set memory amount, and then splits a heap having the same size as the acquired bundle set memory amount to the
また、メモリ管理バンドル12aは、あるバンドルセットに属するバンドルがOSGiFW上にインストールされRESOLVEイベントを受信した際に、そのバンドルのクラスローダオブジェクトをOSGi標準APIおよびJava標準API(以下、標準API)を通じて取得し、JavaVM10が提供する第2API(後述)を通じて、JavaVM10に対して、バンドルクラスローダオブジェクトとヒープIDとを組にした情報を送信する機能を有する。
Further, when a bundle belonging to a bundle set is installed on OSGiFW and a RESOLVE event is received, the memory management bundle 12a acquires the class loader object of the bundle through the OSGi standard API and the Java standard API (hereinafter, standard API). In addition, through a second API (described later) provided by the
JavaVM10は、外部設計として、第1APIおよび第2APIを有する。第1APIは、バンドルセットメモリ量を引数に取り、指定されたバンドルセットメモリ量を持つ分割ヒープ領域を新規に生成して、その生成された分割ヒープ領域のヒープIDを返す機能を有する。
The
第2APIは、クラスローダオブジェクトとヒープIDとを引数に取り、指定されたクラスローダオブジェクトからロードされるバンドルが確保(消費)するメモリ領域を、指定されたヒープIDの分割ヒープ領域から確保する要求を受け付ける機能を有する。 The second API takes a class loader object and a heap ID as arguments, and requests to secure a memory area secured (consumed) by a bundle loaded from the designated class loader object from the divided heap area of the designated heap ID. It has a function to accept.
一方、JavaVM10は、内部設計として、クラスローダオブジェクトに対してヒープIDを設定可能なデータ構造が追加されている。第1APIが呼び出された時には、分割ヒープ領域を生成する機能を有する。第2APIが呼び出された時には、指定されたクラスローダオブジェクトのデータ構造に、指定されたヒープIDを設定する機能を有する。
On the other hand, the
また、指定されたヒープIDの分割ヒープ領域に、バンドルが確保(消費)するメモリ領域を割り当てる機能、又は、ヒープ選択アルゴリズム(後述)によりヒープIDを決定し、決定されたヒープIDの分割ヒープ領域に、バンドルが確保(消費)するメモリ領域を割り当てる機能を有する。 Further, a function for allocating a memory area secured (consumed) by a bundle to a divided heap area of a specified heap ID, or a heap ID determined by a heap selection algorithm (described later), and a divided heap area of the determined heap ID And a function of allocating a memory area to be secured (consumed) by the bundle.
なお、分割ヒープ領域内でメモリ不足の場合(例えば、SPバンドルセット毎に必要なメモリ量が確保できない場合)には、分割ヒープ領域ごとにOOMエラーを発生させる。 In addition, when the memory is insufficient in the divided heap area (for example, when the memory amount necessary for each SP bundle set cannot be secured), an OOM error is generated for each divided heap area.
〔メモリ管理装置の動作について〕
次に、メモリ管理装置1の動作について説明する。なお、理解を容易にするため、以降では、SPバンドルセット13のSPバンドル131を例に用いて説明する。また、その場合におけるバンドルセット情報を、SPバンドルセット情報と記載する。
[Operation of memory management device]
Next, the operation of the
最初に、メモリ管理バンドル12aが、通信ネットワークを介して接続された外部のサーバ3から、SPバンドルセット情報とSPバンドルセットメモリ量とを取得する(S1)。
First, the memory management bundle 12a acquires the SP bundle set information and the SP bundle set memory amount from the
次に、S1の後、S1で取得対象であったSPバンドルセット13のSPバンドル131がメモリ管理装置1にインストールされRESOLVEイベントを受信した際に、メモリ管理バンドル12aは、JavaVM10の第1APIを呼び出して、S1で取得したSPバンドルセットメモリ量の大きさの分割ヒープ領域を生成する要求を行い、生成された分割ヒープ領域に対して設定されたヒープIDを取得する(S2)。
Next, after S1, when the
このとき、JavaVM10は、OSから割り当てられた1つのヒープ領域を分割して、上記SPバンドルセットメモリ量と同じの大きさの分割ヒープ領域を生成し、ヒープIDを返す(S2’)。
At this time, the
S2,S2’の後、メモリ管理バンドル12aは、インストールされたSPバンドル131のクラスローダオブジェクトを標準APIを利用して取得し、取得したクラスローダオブジェクトと、S2で取得したヒープIDとを指定してJavaVM10の第2APIを呼び出す(S3)。
After S2 and S2 ′, the memory management bundle 12a acquires the class loader object of the installed
最後に、JavaVM10は、S3で指定されたヒープIDの分割ヒープ領域、又は、採用するヒープ選択アルゴリズム(後述)に基づいて決定されたヒープIDの分割ヒープ領域に、インストールされたSPバンドル131が確保(消費)するメモリ領域を割り当てる(S4)。これより、SPバンドル131は、割り当てられた分割ヒープ領域を用いて自身のプログラムを実行する。
Finally, the
以上より、SPバンドルセット13に利用許可されたバンドルセットメモリ量と同じ大きさの分割ヒープ領域を生成し、生成された分割ヒープ領域、又は、ヒープ選択アルゴリズムに基づいて決定された分割ヒープ領域に、SPバンドルセット13のSPバンドル131が確保(消費)するメモリ領域を割り当てるので、SPバンドル131が消費するメモリ消費量を任意の単位で制限できる。
As described above, a split heap area having the same size as the bundle set memory amount permitted to be used by the SP bundle set 13 is generated, and the generated split heap area or the split heap area determined based on the heap selection algorithm is generated. Since the memory area secured (consumed) by the
また、分割ヒープ領域を生成するので、従来技術では1つだったヒープ領域を複数持たせることができる。 Further, since the divided heap area is generated, it is possible to have a plurality of heap areas which were one in the prior art.
また、割り当てられる分割ヒープ領域を、ヒープ選択アルゴリズムに基づいて決定するので、制限する単位を変更できる。 Moreover, since the divided heap area to be allocated is determined based on the heap selection algorithm, the limiting unit can be changed.
また、第2APIで設定する情報は、ヒープ選択アルゴリズムで参照される。テーブルなどの検索を行うことなく、スタックからポインタ参照で辿れる情報のみを利用しているので、プログラム動作中のメモリ割当における速度低下を低減できる。 Information set by the second API is referred to by a heap selection algorithm. Since only information that can be traced by pointer reference from the stack without using a table search is used, it is possible to reduce the speed reduction in memory allocation during program operation.
また、特に、ヒープ選択アルゴリズムに基づいて決定された分割ヒープ領域にSPバンドル131が消費するメモリ領域を割り当てるので、PFセット14やSPバンドルセット13が消費するヒープ領域を、ヒープアルゴリズムの効果の単位で制限することが可能になる。
In particular, since the memory area consumed by the
なお、本実施の形態では、サーバ3から取得されるバンドルセット情報等のバンドル、JavaVM10に対して生成要求される分割ヒープ領域のバンドル、クラスローダからロードされるバンドル、メモリ領域が割り当てられて確保(消費)されるバンドル等の全てについて、前述したようにSPバンドル131を例に用いて説明したが、これはあくまでも一例である。
In the present embodiment, a bundle such as bundle set information acquired from the
SPバンドル131に代えて、又は加えて、1以上のバンドルを有するバンドル群であるSPバンドルセット13やPFセット14、PFセット14に含まれるオーナーバンドルを用いることも可能である。
Instead of or in addition to the
また、本実施の形態では、1つのヒープ領域を分割して分割ヒープ領域を生成する方法を例に説明したが、これはあくまでも一例である。SPバンドルセットメモリ量と同じ大きさのヒープ領域を新たに生成する方法や、元々のヒープ領域を分割する方法も利用できる。 In the present embodiment, the method of generating one divided heap area by dividing one heap area has been described as an example, but this is only an example. A method of newly generating a heap area having the same size as the SP bundle set memory amount or a method of dividing the original heap area can also be used.
すなわち、利用が許可されたメモリ量と同じ大きさのヒープ領域を自機のヒープ領域から確保して、そのヒープ領域にバンドル群が利用するメモリ領域を割り当てるのであれば、どのような方法も採用できる。 In other words, any method can be used as long as a heap area of the same size as the amount of memory allowed to be used is allocated from the own heap area and a memory area used by the bundle group is allocated to the heap area. it can.
〔ヒープ選択アルゴリズム〕
次に、ヒープ選択アルゴリズムについて説明する。
[Heap selection algorithm]
Next, a heap selection algorithm will be described.
前述したように、メモリ割当を分割ヒープ領域に行う際、メモリ割当を行うヒープIDを選択するヒープ選択アルゴリズムによって、どの単位でメモリ消費量を制限できるかが変化することになる。本実施の形態では、一例として、4つのヒープ選択アルゴリズムについて説明する。 As described above, when the memory allocation is performed on the divided heap area, the unit in which the memory consumption can be limited changes depending on the heap selection algorithm for selecting the heap ID for performing the memory allocation. In the present embodiment, four heap selection algorithms will be described as an example.
ここで、PFセット14とSPバンドルセット13との関係性を考える。PFセット14とSPバンドルセット13とのどちらがクラス提供側・呼び出し側になるのかは、以下の4通り(2×2通り)が考えられる。 Here, the relationship between the PF set 14 and the SP bundle set 13 is considered. The following four types (2 × 2) can be considered as which of the PF set 14 and the SP bundle set 13 is the class providing side / calling side.
象限a)呼び出し側 :PFセット。 Quadrant a) Caller: PF set.
クラス提供側:PFセット。 Class provider: PF set.
象限b)呼び出し側 :SPバンドルセットY(SP_Y)。 Quadrant b) Caller: SP bundle set Y (SP_Y).
クラス提供側:PFセット。 Class provider: PF set.
象限c)呼び出し側 :PFセット。 Quadrant c) Caller: PF set.
クラス提供側:SPバンドルセットX(SP_X)。 Class provider side: SP bundle set X (SP_X).
象限d)呼び出し側 :SPバンドルセット(SP_Y)。 Quadrant d) Caller: SP bundle set (SP_Y).
クラス提供側:SPバンドルセット(SP_X)。 Class provider side: SP bundle set (SP_X).
なお、象限bと象限cとについては、PFセットにとってはいずれもSPバンドルセットであるので、SPバンドルセットはXでもYでも良いが、ここでは便宜上区別している。 Since quadrant b and quadrant c are both SP bundle sets for the PF set, the SP bundle set may be X or Y, but is distinguished here for convenience.
それら各象限についてスタックで表すと、それぞれ、図4〜図7に示すようなスタックになる。これらを表で表すと、図8に示すようになる。 If each of these quadrants is represented by a stack, the stacks shown in FIGS. 4 to 7 are obtained. These are represented in a table as shown in FIG.
また、後述する各ヒープ選択アルゴリズムにおいて、どの分割ヒープ領域が選択されるかを表す具体的な例として、図9A(a)に示すように、一番下のスタックをスタック[0]のPFセットのスタックとして積み重なったスタックを用いる。 In addition, as a specific example showing which divided heap area is selected in each heap selection algorithm described later, as shown in FIG. 9A (a), the bottom stack is a PF set of stack [0]. Use the stacked stack as the stack.
なお、各スタック内の模様は、各スタック(すなわち、各クラス)で消費されるメモリ領域が、SPバンドルセット1(以下、SP_BS1),SPバンドルセット2(以下、SP_BS2),PFセットのどのメモリ消費量としてカウントされるかを表す。また、各スタック内の文字は、各スタックを生成したクラスの提供元を表す。 The pattern in each stack indicates that the memory area consumed by each stack (ie, each class) is the SP bundle set 1 (hereinafter referred to as SP_BS1), SP bundle set 2 (hereinafter referred to as SP_BS2), or PF set. Indicates whether it is counted as consumption. The characters in each stack represent the provider of the class that generated each stack.
すなわち、JavaVM上で動作するあるスレッドにおける、図9A(a)のスタックについて言えば、スタック[0]においてPFセット(のクラス、以下省略)がSP_BS1(のクラス、以下省略)を呼び出してスタック[1]とし、スタック[1]のSP_BS1がPFセットを呼び出してスタック[2]とし、スタック[2]のPFセットがPFセットを呼び出してスタック[3]とし、スタック[3]のPFセットがSP_BS2を呼び出してスタック[4]とし、スタック[4]のSP_BS2がSP_BS1を呼び出してスタック[5]とし、スタック[5]のSP_BS1がPFセットを呼び出してスタック[6]としている。そして、最後に呼び出された一番上のスタック[6]から処理が順次行われる。 That is, in the case of the stack of FIG. 9A in a thread operating on JavaVM, the PF set (its class, omitted below) calls SP_BS1 (its class, omitted below) in stack [0] and the stack [ 1], SP_BS1 of stack [1] calls the PF set to stack [2], the PF set of stack [2] calls the PF set to stack [3], and the PF set of stack [3] is SP_BS2 And SP_BS2 of stack [4] calls SP_BS1 to make stack [5], and SP_BS1 of stack [5] calls the PF set to make stack [6]. Then, processing is sequentially performed from the top stack [6] called last.
以下、ヒープ選択アルゴリズムを説明する前に、用語の定義を行う。定数を大文字、変数の頭文字は小文字で表す(ここでの定数は、1回のヒープ選択アルゴリズムにおいて代入がない値を指す)。ヒープ選択アルゴリズムは、最終的にメモリ割当を行うヒープIDである変数heapIDを決定するためのアルゴリズムである。 Hereinafter, terms will be defined before describing the heap selection algorithm. The constant is capitalized and the initial letter of the variable is small letter (the constant here indicates a value that is not assigned in one heap selection algorithm). The heap selection algorithm is an algorithm for determining a variable heapID that is a heap ID for finally allocating memory.
クラスローダに設定されているヒープIDをCL_HEAPIDとする。PFセットのCL_HEAPIDをHEAPID_PFとする。SPバンドルセットのCL_HEAPIDをHEAPID_SPとする。各スタックにて処理が行われるクラスのCL_HEAPIDをSTACK_HEAPIDとする。 The heap ID set in the class loader is CL_HEAPID. Let CL_HEAPID of the PF set be HEAPID_PF. Let CL_HEAPID of the SP bundle set be HEAPID_SP. The CL_HEAPID of the class that is processed in each stack is defined as STACK_HEAPID.
スタックを1つずつ下に辿っていくにあたり、現在調べているスタックを表す変数をcurStackとする。heapIDを決定するために一時的に利用する変数をcurheapIDとする。各スレッドの一番上のスタックをTOPSTACKとする。 As the stack is traced down one by one, the variable representing the currently examined stack is curStack. A variable that is temporarily used to determine the heap ID is a cure ID. Let the top stack of each thread be TOPSTACK.
curStackがスレッドを下まで辿り、最後のスタックの次を指定した場合、Nullを指すとする。 If curStack follows the thread down and designates the next of the last stack, it will point to Null.
ヒープメモリの確保はスレッドの一番上のスタックで実行されるので、ヒープ選択アルゴリズムは、常にTOPSTACKにおいてメモリ割当が必要となる度に実行される。 Since heap memory allocation is executed in the top stack of the thread, the heap selection algorithm is always executed every time memory allocation is required in TOPSTOP.
<第1ヒープ選択アルゴリズム>
第1ヒープ選択アルゴリズムの動作を示すフローチャートを図10に示す。なお、以下説明する全てのヒープ選択アルゴリズムの主体は、JavaVM10である。
<First heap selection algorithm>
A flowchart showing the operation of the first heap selection algorithm is shown in FIG. The subject of all the heap selection algorithms described below is JavaVM10.
TOPSTACKのSTACK_HEAPIDをheapIDとする(S101)。 The STACK_HEAPID of the TOPSTACK is set as the heatID (S101).
すなわち、図9A(b)に示すように、各スタックのクラスが確保(消費)するメモリ領域を、各スタックのクラスに対してそれぞれ生成された分割ヒープ領域にそれぞれ割り当てるようにしている。 That is, as shown in FIG. 9A (b), the memory area secured (consumed) by each stack class is allocated to each divided heap area generated for each stack class.
以上より、各スタックのクラスが確保(消費)するメモリ領域を、各スタックのクラスに対してそれぞれ生成された分割ヒープ領域にそれぞれ割り当てるので、呼び出し元に関わらず、実装クラスのセット単位(すなわち、PFセットやSPバンドルセットのバンドル群単位)でメモリ消費量をカウントでき、当該カウント方法によってメモリ消費量を制限できる。 As described above, since the memory area secured (consumed) by each stack class is allocated to each divided heap area generated for each stack class, the set unit of the implementation class (that is, regardless of the caller) Memory consumption can be counted in units of bundle groups of PF sets and SP bundle sets), and the memory consumption can be limited by the counting method.
<第2ヒープ選択アルゴリズム>
第2ヒープ選択アルゴリズムの動作を示すフローチャートを図11に示す。第2ヒープ選択アルゴリズムは、スタックを1つずつ下に辿り、呼び出し元となるスタックを探索するアルゴリズムである。各スタックは、あるスレッドにおいて呼び出し・呼び出される関係にある。
<Second heap selection algorithm>
FIG. 11 is a flowchart showing the operation of the second heap selection algorithm. The second heap selection algorithm is an algorithm for tracing down the stack one by one and searching for a call source stack. Each stack has a relationship of being called and called in a certain thread.
最初に、curStackにTOPSTACKを代入する(S201)。 First, TOPSTACK is substituted for curStack (S201).
次に、curStackがNullならばS204に進み、それ以外であればS203に進む(S202)。 Next, if curStack is Null, the process proceeds to S204, and otherwise, the process proceeds to S203 (S202).
次に、curStackを1つ下のスタックにする(S203)。 Next, curStack is moved down one stack (S203).
最後に、curStackのSTACK_HEAPIDをheapIDとする(S204)。 Finally, STACK_HEAPID of curStack is set as a heap ID (S204).
つまり、TOPSTACKの呼び出し元スタックを、その呼び出し元スタックの呼び出し元スタックを…と繰り返して呼び出し元を辿っていく。結果的に、スレッドの一番下のスタックのクラスローダに設定されているヒープIDを参照する。 That is, the caller stack of TOPSTACK is repeated, the caller stack of the caller stack is repeated, and the caller is traced. As a result, the heap ID set in the class loader of the stack at the bottom of the thread is referred to.
すなわち、全てのスタックのクラスが確保(消費)するメモリ領域を、最初に呼び出しを行ったスタックのクラスに対して生成された分割ヒープ領域に割り当てるようにしている。 In other words, the memory area secured (consumed) by all the stack classes is allocated to the divided heap area generated for the stack class that made the first call.
なお、このアルゴリズムを実行すると、スタックの例としては図9A(c)に示すようになる。例えば、スタック[6]が確保(消費)するメモリ領域が、どのようにカウントされるかを以下説明する。 When this algorithm is executed, an example of the stack is as shown in FIG. 9A (c). For example, how the memory area secured (consumed) by the stack [6] is counted will be described below.
スタック[6]を呼び出したのはスタック[5]であり、スタック[5]を呼び出したのはスタック[4]である。スタック[4]を呼び出したのはスタック[3]であり、スタック[3]を呼び出したのはスタック[2]である。スタック[2]を呼び出したのはスタック[1]であり、スタック[1]を呼び出したのはスタック[0]である。 The stack [6] is called by the stack [5], and the stack [5] is called by the stack [4]. The stack [4] is called by the stack [3], and the stack [3] is called by the stack [2]. The stack [2] is called by the stack [1], and the stack [1] is called by the stack [0].
スタック[0]には呼び出し元がないため、結果的にスタック[6]のメモリ消費量はスタック[0]が呼び出したとカウントされ、スタック[0]のPFセットのメモリ消費量としてカウントされる。 Since there is no caller in the stack [0], as a result, the memory consumption of the stack [6] is counted as the call of the stack [0], and is counted as the memory consumption of the PF set of the stack [0].
スタック[6]の処理が行われた後、スタック[6]はスレッドからなくなりスタック[5]がTOPSTACKになる。スタック[5]〜[0]でも同様の処理が行われるので、全て、スタック[0]が呼び出したメモリとカウントされる。 After the processing of stack [6] is performed, stack [6] disappears from the thread and stack [5] becomes TOPSTOP. Since the same processing is performed in the stacks [5] to [0], all the stacks [0] are counted as the calling memory.
以上より、全てのスタックのクラスが確保(消費)するメモリ領域を、最初に呼び出しを行ったスタックのクラスに対する分割ヒープ領域に割り当てるので、メモリ消費量をスレッド単位でカウントでき、当該カウント方法によってメモリ消費量を制限できる。 As described above, since the memory area secured (consumed) by all stack classes is allocated to the divided heap area for the stack class that first called the memory, the memory consumption can be counted on a per-thread basis. The consumption can be limited.
<第3ヒープ選択アルゴリズム>
第3ヒープ選択アルゴリズムの動作を示すフローチャートを図12に示す。第3ヒープ選択アルゴリズムは、TOPSTACKでメモリ割当が起こるたびに分割ヒープを選択するアルゴリズムである。
<Third heap selection algorithm>
A flowchart showing the operation of the third heap selection algorithm is shown in FIG. The third heap selection algorithm is an algorithm for selecting a divided heap every time memory allocation occurs in TOPSTOP.
最初に、heapIDにHEAPID_PFを代入する(S301)。 First, HEAPID_PF is substituted for heapID (S301).
次に、curStackにTOPSTACKを代入する(S302)。 Next, TOPSTACK is substituted for curStack (S302).
次に、curheapIDにSTACK_HEAPIDを代入する(S303)。 Next, STACK_HEAPID is substituted for curheapID (S303).
次に、curheapIDがHEAPID_PFならばS305に進み、それ以外であればS306に進む(S304)。 Next, if curheapID is HEAPID_PF, the process proceeds to S305, and otherwise, the process proceeds to S306 (S304).
次に、heapIDがHEAPID_SPならばheapIDに入っている値が本アルゴリズムによって選択された分割ヒープ領域として処理を終了し、それ以外であればS306に進む(S305)。 Next, if the heapID is HEAPID_SP, the process is terminated as a divided heap area in which the value included in the heapID is selected by the present algorithm. Otherwise, the process proceeds to S306 (S305).
次に、heapIDにcurheapIDを代入する(S306)。 Next, the cure ID is substituted into the heat ID (S306).
次に、curStackを1つ下のスタックにする(S307)。 Next, curStack is moved down one stack (S307).
最後に、curStackがNullならばheapIDに入っている値が本アルゴリズムによって選択された分割ヒープ領域として処理を終了し、そうでないならばS303に戻る(S308)。 Finally, if curStack is Null, the process ends as the divided heap area in which the value included in the heapID is selected by the present algorithm, and if not, the process returns to S303 (S308).
つまり、(バンドルの有する)機能提供者であるPF事業者によって生成されたPFセットと、機能利用者であるSP事業者によって生成されたSPバンドルセット間の関係において、メモリ消費量は呼び出し・クラス提供に関わらず、機能を利用しているSPバンドルセットのメモリ消費量としてカウントされる。 In other words, in the relationship between the PF set generated by the PF provider that is the function provider (with the bundle) and the SP bundle set generated by the SP provider that is the function user, the memory consumption is the call class. Regardless of the provision, it is counted as the memory consumption of the SP bundle set that uses the function.
すなわち、機能を提供するPFセット(機能提供バンドル群)が確保(消費)するメモリ領域を、機能を利用するSPバンドルセット(機能利用バンドル群)に対して生成された分割ヒープ領域に割り当てるようにしている。 That is, the memory area secured (consumed) by the PF set (function providing bundle group) that provides the function is allocated to the divided heap area generated for the SP bundle set (function use bundle group) that uses the function. ing.
なお、システムの基盤となるPFセットが、SPバンドルセットを利用することによってPFセットのための機能を実現することはあり得ない。 It should be noted that the PF set serving as the base of the system cannot realize the function for the PF set by using the SP bundle set.
例えば、象限bの例として、PFの共通的な機能としてPFセットがHttpServiceを実装したバンドルを提供することが考えられる。SPバンドルはHttpServiceを取得し、呼び出すことによりPFセットの提供するHttpServiceの機能を利用する。 For example, as an example of the quadrant b, it is conceivable that the PF set provides a bundle in which HttpService is implemented as a common function of the PF. The SP bundle obtains http service and uses the function of http service provided by the PF set by calling.
また、象限cの代表例は、OSGi仕様で定義されるBundleActivator#startの呼び出しである。呼び出すのはOSGiFW、つまりPFセットであるが、SPバンドルがクラス提供した理由は、PFセットが提供する「SPバンドルを対象端末上で起動する機能」を利用する為である。 A representative example of the quadrant c is a call to BundleActivator # start defined in the OSGi specification. The OSGiFW, that is, the PF set is called, but the reason why the SP bundle provides the class is to use the “function for starting the SP bundle on the target terminal” provided by the PF set.
どのような場合においても、象限cは、背景技術で説明した通りコールバック型、つまりクラス提供側であるSPバンドルセットが機能を利用する形となる。 In any case, the quadrant c is a callback type as described in the background art, that is, the SP bundle set on the class providing side uses the function.
但し、象限aやd、つまりPFセットがPFセットを呼び出した場合や、SPバンドルセットがSPバンドルセットを呼び出した場合は、機能の提供利用によらず、呼び出したSPバンドルセットのメモリ消費量とカウントする。 However, when quadrants a and d, that is, when a PF set calls a PF set, or when an SP bundle set calls an SP bundle set, the memory consumption of the called SP bundle set is Count.
呼び出し元・クラス提供スタックの関係を表すと、図13に示すようになる。この図は、2つのスタックの関係において、上のスタック(クラス提供スタック)で消費されたメモリが、呼び出し元スタックとクラス提供スタックどちらのスタックにカウントされるかを示している。 FIG. 13 shows the relationship between the caller and the class providing stack. This figure shows, in the relationship between two stacks, whether the memory consumed in the upper stack (class providing stack) is counted as the stack of the caller stack or the class providing stack.
ここで、スタックが複数積み重なった例を、図9A(d)を用いて説明する。まず、PFセットのクラスにあたるスタック[6]で消費されるメモリ量は、呼び出し元スタック[5]がSPバンドルセット1なので、呼び出し元スタック[5]が消費したメモリ量としてカウントされる(象限b)。 Here, an example in which a plurality of stacks are stacked will be described with reference to FIG. 9A (d). First, the amount of memory consumed by the stack [6] corresponding to the class of the PF set is counted as the amount of memory consumed by the caller stack [5] because the caller stack [5] is the SP bundle set 1 (quadrant b) ).
SPバンドルセット1であるスタック[5]で消費されるメモリ量は、呼び出し元スタック[4]がSPバンドルセット2なので、呼び出し元スタック[4]で消費されるメモリとしてカウントされる(象限d)。 The amount of memory consumed by the stack [5] which is the SP bundle set 1 is counted as the memory consumed by the caller stack [4] since the caller stack [4] is the SP bundle set 2 (quadrant d). .
スタック[4]で消費されるメモリ量は、呼び出元スタック[3]がPFセットなので、クラス提供スタック[4]で消費されるメモリ量とカウントされる(象限c)。 The amount of memory consumed in the stack [4] is counted as the amount of memory consumed in the class providing stack [4] because the caller stack [3] is a PF set (quadrant c).
よって、スタック[4]〜[6]において消費されるメモリ量は、スタック[4]に該当するクラスを提供するSPバンドルセット2が消費するメモリ量としてカウントされる。 Therefore, the memory amount consumed in the stacks [4] to [6] is counted as the memory amount consumed by the SP bundle set 2 that provides the class corresponding to the stack [4].
同様に、スタック[3]で消費されるメモリ量は、呼び出し元スタック[2]がPFセットなので、呼び出し元スタック[2]の消費メモリとカウントとされる(象限a)。 Similarly, the amount of memory consumed by the stack [3] is counted as the consumed memory of the caller stack [2] because the caller stack [2] is a PF set (quadrant a).
スタック[2]で消費されるメモリ量は、呼び出し元スタック[1]がSPバンドルセット1なので、呼び出し元スタック[1]の消費メモリとカウントとされる(象限b)。 The amount of memory consumed in the stack [2] is counted as the consumed memory of the caller stack [1] because the caller stack [1] is the SP bundle set 1 (quadrant b).
スタック[1]で消費されるメモリ量は、呼び出し元スタック[0]がPFセットなので、クラス提供スタック[1]で消費されるメモリ量とカウントされる(象限c)。 The amount of memory consumed in the stack [1] is counted as the amount of memory consumed in the class providing stack [1] because the caller stack [0] is a PF set (quadrant c).
よって、スタック[1]〜[3]において消費されるメモリ量は、スタック[1]に該当するクラスを提供するSPバンドルセット1が消費するメモリ量としてカウントされる。 Therefore, the memory amount consumed in the stacks [1] to [3] is counted as the memory amount consumed by the SP bundle set 1 that provides the class corresponding to the stack [1].
最後に、スタック[0]で消費されるメモリ量は、呼び出し元スタックが存在しないので、クラス提供スタックであるスタック[0]が消費しているメモリ量とカウントとする。 Finally, the amount of memory consumed by the stack [0] is counted as the amount of memory consumed by the stack [0], which is the class providing stack, since there is no caller stack.
よって、スタック[0]で消費されるメモリ量は、スタック[0]に該当するクラスを提供するPFセットが消費するメモリ量としてカウントされる。 Therefore, the memory amount consumed by the stack [0] is counted as the memory amount consumed by the PF set that provides the class corresponding to the stack [0].
以上より、機能を提供するPFセットが確保(消費)するメモリ領域を、機能を利用するSPバンドルセットに対する分割ヒープ領域に割り当てるので、メモリ消費量を、機能を利用するバンドルセット単位でカウントでき、当該カウント方法によってメモリ消費量を制限できる。 As described above, since the memory area secured (consumed) by the PF set that provides the function is allocated to the divided heap area for the SP bundle set that uses the function, the memory consumption can be counted in units of bundle sets that use the function. The memory consumption can be limited by the counting method.
<第4ヒープ選択アルゴリズム>
第3ヒープ選択アルゴリズムでは、機能の提供・利用の関係について、機能を提供するPFセットと機能を利用するSPバンドルセットとを用いて説明した。
<4th heap selection algorithm>
In the third heap selection algorithm, the function provision / use relationship has been described using the PF set that provides the function and the SP bundle set that uses the function.
一方、同関係はSPバンドルセット同士にもあるため、第4ヒープ選択アルゴリズムではその場合について説明する。 On the other hand, since the same relationship exists between SP bundle sets, the fourth heap selection algorithm will explain that case.
以下説明する第4ヒープ選択アルゴリズムを実現するために、メモリ管理バンドル12aおよびJavaVM10に対して以下の機能を追加する。
In order to realize the fourth heap selection algorithm described below, the following functions are added to the memory management bundle 12a and the
メモリ管理バンドル12aは、SPバンドル131のクラスが機能の提供・利用どちらを行うクラスかの情報を入手する機能を更に有する。また、JavaVM10が提供する第3API(後述)を通じて、JavaVM10に対して、クラスごとに機能の提供・利用(Call Back Flag、以下、CBF)を設定する要求を行う機能を更に有する。
The memory management bundle 12a further has a function of obtaining information as to whether the class of the
JavaVM10は、外部設計として、クラスオブジェクトとCBFとを引数に取り、指定されたクラスが機能を提供するクラスか機能を利用するクラスかをJavaVM10に設定する第3APIを有する。内部設計として、クラスオブジェクトのデータ構造にCBFを設定できるデータ構造を用意し、第3APIが呼び出された時に、指定されたクラスオブジェクトのデータ構造に指定されたCBFを設定する機能を有する。
As an external design, the
このような機能を有する際のメモリ管理装置1の動作について以下説明する。
The operation of the
最初に、メモリ管理バンドル12aが、通信ネットワークを介して接続された外部のサーバ3から、SPバンドルセット情報とSPバンドルセットメモリ量とを取得すると共に、当該取得対象であるSPバンドルセット13のSPバンドル131のクラスにセットするCBFを取得する(S11)。
First, the memory management bundle 12a acquires the SP bundle set information and the SP bundle set memory amount from the
次に、S11の後、S11で取得対象であったSPバンドルセット13のSPバンドル131がメモリ管理装置1にインストールされRESOLVEイベントを受信した際に、メモリ管理バンドル12aは、JavaVM10の第1APIを呼び出して、S11で取得したSPバンドルセットメモリ量の大きさの分割ヒープ領域を生成する要求を行い、生成された分割ヒープ領域に対して設定されたヒープIDを取得する(S12)。
Next, after S11, when the
このとき、JavaVM10は、OSから割り当てられた1つのヒープ領域を分割して、上記SPバンドルセットメモリ量と同じの大きさの分割ヒープ領域を生成し、ヒープIDを返す(S12’)。
At this time, the
S12,S12’の後、メモリ管理バンドル12aは、インストールされたSPバンドル131のクラスローダオブジェクトを標準APIを利用して取得し、取得したクラスローダオブジェクトとS12で取得したヒープIDとを指定してJavaVM10の第2APIを呼び出す(S13)。
After S12 and S12 ′, the memory management bundle 12a acquires the class loader object of the installed
また、S13で取得したクラスローダオブジェクトとS11で取得したCBFとを指定し、第3APIを呼び出す(S14)。 Further, the class loader object acquired in S13 and the CBF acquired in S11 are specified, and the third API is called (S14).
最後に、JavaVM10は、S14で指定されたクラスオブジェクトのデータ構造にS14で指定されたCBFを設定した後に、後述する第4ヒープ選択アルゴリズムに基づいて決定されたヒープIDの分割ヒープ領域に、インストールされたSPバンドル131が確保(消費)するメモリ領域を割り当てる(S15)。
Finally, after setting the CBF specified in S14 in the data structure of the class object specified in S14, the
CBFは、そのクラスがクラスの提供・利用どちらのクラスかを表している。機能提供クラスがSPバンドルセットから呼び出され、機能提供クラスのスタックで消費されたメモリは、呼び出したSPバンドルセットの消費メモリとカウントする。 The CBF indicates whether the class is a class providing or using the class. The memory provided by the function providing class is called from the SP bundle set and consumed by the stack of the function providing class is counted as the consumed memory of the called SP bundle set.
一方、機能利用クラスがSPバンドルセットから呼び出され、機能利用クラスのスタックで消費されたメモリは、呼び出したSPバンドルセットのメモリ消費量とカウントする。 On the other hand, the memory used by the function usage class is called from the SP bundle set and consumed in the stack of the function usage class is counted as the memory consumption of the called SP bundle set.
すなわち、機能を提供するSPバンドルセット(機能提供バンドル群)が確保(消費)するメモリ領域を、機能を利用するSPバンドルセット(機能利用バンドル群)に対して生成された分割ヒープ領域に割り当てるようにしている。 That is, the memory area secured (consumed) by the SP bundle set (function providing bundle group) that provides the function is allocated to the divided heap area generated for the SP bundle set (function using bundle group) that uses the function. I have to.
第4ヒープ選択アルゴリズムの動作を示すフローチャートを図14に示す。第4ヒープ選択アルゴリズムは、TOPSTACKでメモリ割当が起こるたびに分割ヒープを選択する。なお、CUR_CBFはcurStackのクラスのCBFを表し、last_CBFは、curStackの1つ上のスタックのクラスのCBFを表す。 FIG. 14 is a flowchart showing the operation of the fourth heap selection algorithm. The fourth heap selection algorithm selects a divided heap every time memory allocation occurs in TOPSTOP. CUR_CBF represents the CBF of the curStack class, and last_CBF represents the CBF of the stack class one level above the curStack.
最初に、heapIDにHEAPID_PFに代入する(S401)。 First, HEAPID_PF is substituted for heapID (S401).
次に、curStackにTOPSTACKを代入する(S402)。 Next, TOPSTACK is substituted into curStack (S402).
次に、last_CBFに機能提供を代入する(S403)。 Next, function provision is substituted into last_CBF (S403).
次に、curheapIDにSTACK_HEAPIDを代入する(S404)。 Next, STACK_HEAPID is substituted for curheapID (S404).
次に、curheapIDがHEAPID_PFならばS410に進み、そうでないならばS406に進む(S405)。 Next, if curheapID is HEAPID_PF, the process proceeds to S410, and if not, the process proceeds to S406 (S405).
次に、curheapIDがheapIDと同じならばS410に進み、そうでないならばS407に進む(S406)。 Next, if curheapID is the same as heapID, the process proceeds to S410, and if not, the process proceeds to S407 (S406).
次に、heapIDがHEAPID_PFならばS409に進み、そうでないならばS408に進む(S407)。 Next, if heapID is HEAPID_PF, the process proceeds to S409, and if not, the process proceeds to S408 (S407).
次に、lastCBFが機能利用ならば処理を終了し、そうでないならばS409に進む(S408)。 Next, if the last CBF is a function use, the process is terminated, and if not, the process proceeds to S409 (S408).
次に、heapIDにcurheapIDを代入する(S409)。 Next, the cure ID is substituted for the heat ID (S409).
次に、last_CBFにCUR_CBFを代入する(S410)。 Next, CUR_CBF is substituted into last_CBF (S410).
次に、curStackを1つ下のスタックにする(S411)。 Next, curStack is moved down one stack (S411).
最後に、curStackがNullでならば処理を終了し、そうでないならばS403に戻る(S412)。 Finally, if curStack is Null, the process is terminated; otherwise, the process returns to S403 (S412).
呼び出し元・クラス提供スタックの関係を表すと、図15に示すようになる。 FIG. 15 shows the relationship between the caller and the class providing stack.
ここで、スタックが複数積み重なった例を、図9B(e),(f)を用いて説明する。まず、スタック[5]が機能利用クラスである図9B(e)においてどのようにカウントされるかを説明する。 Here, an example in which a plurality of stacks are stacked will be described with reference to FIGS. 9B (e) and 9 (f). First, how stack [5] is counted in FIG. 9B (e), which is a function usage class, will be described.
PFセットのクラスにあたるスタック[6]で消費されるメモリ量は、呼び出し元スタック[5]がSPバンドルセット1なので、呼び出し元スタック[5]が消費したメモリ量としてカウントされる(象限b)。 The amount of memory consumed by the stack [6] corresponding to the class of the PF set is counted as the amount of memory consumed by the caller stack [5] because the caller stack [5] is the SP bundle set 1 (quadrant b).
SPバンドルセット1であるスタック[5]で消費されるメモリ量は、呼び出し元スタックがSPバンドルセット2であり、機能利用クラスであるので、クラス提供スタック[5]で消費されるメモリとしてカウントされる(象限d)。なお、スタック[4]〜スタック[0]については第3ヒープ選択アルゴリズムと同様である。 The amount of memory consumed by the stack [5] which is the SP bundle set 1 is counted as the memory consumed by the class providing stack [5] because the calling stack is the SP bundle set 2 and is a function use class. (Quadrant d). Stack [4] to stack [0] are the same as the third heap selection algorithm.
次に、スタック[5]が機能提供クラスである図9B(f)においてどのようにカウントされるかを説明する。 Next, how stack [5] is counted in FIG. 9B (f), which is a function providing class, will be described.
PFセットのクラスにあたるスタック[6]で消費されるメモリ量は、呼び出し元スタック[5]がSPバンドルセット1なので、呼び出し元スタック[5]が消費したメモリ量としてカウントされる(象限b)。 The amount of memory consumed by the stack [6] corresponding to the class of the PF set is counted as the amount of memory consumed by the caller stack [5] because the caller stack [5] is the SP bundle set 1 (quadrant b).
SPバンドルセット1であるスタック[5]で消費されるメモリ量は、呼び出し元スタックがSPバンドルセット2であり、機能提供クラスであるので、呼び出したSPバンドルセット2で消費されるメモリとしてカウントされる(象限d)。なお、スタック[4]〜スタック[0]については第3ヒープ選択アルゴリズムと同様である。 The amount of memory consumed by the stack [5] which is the SP bundle set 1 is counted as the memory consumed by the called SP bundle set 2 because the calling stack is the SP bundle set 2 and is a function providing class. (Quadrant d). Stack [4] to stack [0] are the same as the third heap selection algorithm.
以上より、機能を提供するSPバンドルセットが確保(消費)するメモリ領域を、機能を利用するSPバンドルセットに対する分割ヒープ領域に割り当てるので、第3ヒープ選択アルゴリズムの効果に加えて、SPバンドルセット同士の呼び出しにおいても、機能の提供・利用によってメモリ消費量のカウント先を変更でき、メモリ消費量を更に制限できる。 As described above, since the memory area secured (consumed) by the SP bundle set that provides the function is allocated to the divided heap area for the SP bundle set that uses the function, in addition to the effect of the third heap selection algorithm, In the call, the count destination of the memory consumption can be changed by providing and using the function, and the memory consumption can be further limited.
また、JavaVM10にクラスオブジェクトのデータ構造にCBFを設定できるデータ構造を用意しているので、クラスごとに機能の提供・利用を判別することができる。
In addition, since a data structure that can set CBF as the data structure of the class object is prepared in the
〔メモリ消費量の計測について〕
次に、JavaVM10におけるメモリ消費量の計測方法について説明する。メモリ消費量を計測するために、JavaVM10に対して、以下の機能を追加する。
[Measurement of memory consumption]
Next, a memory consumption measurement method in the
JavaVM10は、外部設計として、ヒープIDを引数に取り、分割ヒープ領域のメモリ量を計算する第4APIを更に有する。また、内部設計として、第4APIが呼び出された時に、指定されたヒープIDの空きメモリ量を返す機能を有する。
As an external design, the
以下、分割ヒープ領域のメモリ消費量を計測する方法を説明する。 Hereinafter, a method for measuring the memory consumption of the divided heap area will be described.
最初に、JavaVM10は、GCを行う(S21)。例えば、第4APIが呼び出される前に、第4APIを呼び出すプログラム側でSystem.gc()などでGCを行う方法も考えられる。ここでGCは、分割ヒープ領域毎に行うか、ヒープ領域全体に行うかは問わない。
First, the
次に、S21の後、メモリ管理バンドル12aから送信されたヒープIDを取得し、当該ヒープIDの分割ヒープ領域における消費メモリや残りの利用可能メモリを計算する(S22)。 Next, after S21, the heap ID transmitted from the memory management bundle 12a is acquired, and the consumed memory and the remaining available memory in the divided heap area of the heap ID are calculated (S22).
最後に、S22で計算した消費メモリや利用可能メモリをメモリ管理バンドル12aに返す(S23)。 Finally, the consumed memory and available memory calculated in S22 are returned to the memory management bundle 12a (S23).
なお、GCとは、プログラムが動的に確保したメモリ領域のうち、不要になった領域を自動的に解放する処理をいう。 Note that GC is a process of automatically releasing an unnecessary area from among memory areas dynamically allocated by a program.
以上より、分割ヒープ領域単位でメモリ消費量を計測できる。 From the above, memory consumption can be measured in units of divided heap areas.
〔生成済みの分割ヒープ領域の削除について〕
次に、生成済みの分割ヒープ領域の削除方法について説明する。分割ヒープ領域を削除するために、JavaVM10に対して、以下の機能を追加する。
[Deleting the generated divided heap area]
Next, a method for deleting the generated divided heap area will be described. In order to delete the divided heap area, the following function is added to the
JavaVM10は、外部設計として、ヒープIDを引数に取り、分割ヒープ領域を削除する第5APIを更に有する。また、内部設計として、第5APIが呼び出された時に、指定されたヒープIDの分割ヒープ領域を削除する機能を有する。
As an external design, the
以上より、削除対象の分割ヒープ領域が解放される。 As described above, the split heap area to be deleted is released.
〔実施例〕
<PFセットからSPバンドルセットへの呼び出しにおける実施例>
第3,第4ヒープ選択アルゴリズムにおいて、SPバンドルセット1(以下、SP1)が、SPバンドルセット2(以下、SP2)を呼び出す例を考える。
〔Example〕
<Example in Calling from PF Set to SP Bundle Set>
Consider an example in which the SP bundle set 1 (hereinafter referred to as SP1) calls the SP bundle set 2 (hereinafter referred to as SP2) in the third and fourth heap selection algorithms.
SP2の内部でPFセットを呼び出すと、図16に示すようなスタックになる場合がある。このようなスタック構造になるPFセットのクラスには、例えばAccessController.doPrivileged()などがある。 When a PF set is called inside SP2, a stack as shown in FIG. 16 may be obtained. The class of the PF set having such a stack structure includes, for example, AccessController. doPrivileged () and the like.
このようなクラスには、第4ヒープ選択アルゴリズムで説明したCBFを機能提供に設定し、第4ヒープ選択アルゴリズムを適用する。 For such a class, the CBF described in the fourth heap selection algorithm is set to provide a function, and the fourth heap selection algorithm is applied.
以上より、スタック[3]からスタック[4]への呼び出しは、第4ヒープ選択アルゴリズムにおいてはSP2のメモリ消費量とカウントされることになる。この例において、SP1がSP2の機能を利用している場合には、スタック[2]〜スタック[4]の呼び出しは、SP1がSP2の機能を利用するために行われていることになる。 As described above, a call from stack [3] to stack [4] is counted as SP2 memory consumption in the fourth heap selection algorithm. In this example, when SP1 uses the function of SP2, the stack [2] to stack [4] are called in order for SP1 to use the function of SP2.
つまり、スタック[2]〜[4]で消費されたメモリ量は、機能を利用しているSP1のメモリ消費量とカウントされることが望ましく、それを実現することができる。 That is, it is desirable that the memory amount consumed in the stacks [2] to [4] is counted as the memory consumption amount of the SP1 that uses the function, and this can be realized.
<PFセットを詳細に分割する実施例>
ブートストラップクラスローダからロードされるクラスを、JavaVMのクラスとみなし、システムクラスローダからロードされるクラスを、OSGiFWのクラスとみなす。それぞれのクラスローダオブジェクトの構造体に別のヒープIDを設定し、第1ヒープ選択アルゴリズムを用いる。
<Example in which a PF set is divided in detail>
A class loaded from the bootstrap class loader is regarded as a JavaVM class, and a class loaded from the system class loader is regarded as an OSGiFW class. A different heap ID is set in the structure of each class loader object, and the first heap selection algorithm is used.
以上より、同一クラスローダからロードされるクラスごとにメモリ消費量を制限できる。特に、第1ヒープ選択アルゴリズムではPFセットは1つとしたが、PFセットをJavaVMとOSGiFWとに分割できる。 As described above, the memory consumption can be limited for each class loaded from the same class loader. In particular, in the first heap selection algorithm, there is one PF set, but the PF set can be divided into JavaVM and OSGiFW.
<スレッドとヒープIDとを結び付ける実施例>
JavaVM10に、内部設計として、スレッドに対してヒープIDを設定することができるデータの構造体を追加する。この場合、図17に示す第5ヒープ選択アルゴリズムを用いる。
<Example of linking thread and heap ID>
A data structure capable of setting a heap ID for a thread is added to the
このアルゴリズムは、スレッドに設定されたヒープIDの分割ヒープを選択するようにしている。スレッドが立てられる際、スレッドを立てるクラスのクラスローダオブジェクトのヒープIDを、立てるスレッドの構造体に設定する。 This algorithm selects a divided heap with a heap ID set for a thread. When a thread is set up, the heap ID of the class loader object of the class that sets up the thread is set in the structure of the set up thread.
以上より、基本的には、第2ヒープ選択アルゴリズムを用いた場合と同一の効果が得られるが、スタックを下に辿る動作を不要とするので、第2ヒープ選択アルゴリズムを用いた場合よりも高速にメモリ割当を行うヒープIDを決定できる。 As described above, basically, the same effect as that obtained when the second heap selection algorithm is used can be obtained. The heap ID for allocating memory can be determined.
<ヒープメモリ管理方式の実施例>
分割ヒープ領域のメモリ値の設定方式は複数の方式が考えられる。
<Example of heap memory management method>
There are a plurality of methods for setting the memory value of the divided heap area.
メモリ値自由設定方式では、メモリ値を自由に設定することができる。メモリ値を自由に設定することができるので、効率的にメモリを利用することができる。 In the memory value free setting method, the memory value can be set freely. Since the memory value can be set freely, the memory can be used efficiently.
また、ブロック化ヒープ方式は、固定サイズの分割ヒープを予め複数用意しておく方式であり、メモリ値自由設定方式と比べて、ヒープメモリの再生成のオーバーヘッドがないという利点がある。 The blocked heap method is a method in which a plurality of fixed-size divided heaps are prepared in advance, and has an advantage that there is no overhead of regeneration of the heap memory compared to the memory value free setting method.
<GCの実施例>
GCは、分割ヒープ領域毎に行う方式とヒープ領域全体で行う方式とが考えられる。
<Example of GC>
The GC is considered to be performed for each divided heap area or for the entire heap area.
分割ヒープ領域毎に行う方式は、ヒープ領域全体で行う方式と比較して、ある分割ヒープ領域で頻繁にGCが起こる場合でも、他のヒープ領域は影響を受けることなく動作することができる。 The method performed for each divided heap area can operate without being affected by other heap areas even when GC occurs frequently in a certain divided heap area, compared to the method performed for the entire heap area.
一方、ヒープ領域全体で行う方式は、分割ヒープ領域毎で行う方式と比較して、以下の利点がある。第1分割ヒープ領域の次にすぐに第2分割ヒープ領域のGCが発生する等、異なる分割ヒープ領域で頻繁にGCが起こるような状況においては、参照されているオブジェクトをルートから探索する動作が頻繁に起こってしまいオーバーヘッドになる。しかし、ヒープ領域全体でGCを行う場合には、一度に全てのオブジェクトを探索するためこのような、オーバーヘッドがなくなるという利点がある。 On the other hand, the method performed for the entire heap area has the following advantages compared to the method performed for each divided heap area. In a situation where GC occurs frequently in different divided heap areas, such as when a GC occurs in the second divided heap area immediately after the first divided heap area, the operation of searching for the referenced object from the root is performed. It happens frequently and becomes overhead. However, when GC is performed on the entire heap area, all the objects are searched at once, so that there is an advantage that such overhead is eliminated.
1…メモリ管理装置
10…JavaVM(Java仮想マシン)
11…OSGiFW
12…オーナーバンドル
12a…メモリ管理バンドル
13…SPバンドルセット
131…SPバンドル
14…PFセット
S1〜S4,S11〜S15,S101,S201〜S204,S301〜S308,S401〜S412,S501…ステップ
DESCRIPTION OF
11 ... OSGiFW
12 ... Owner bundle 12a ... Memory management bundle 13 ... SP bundle set 131 ...
Claims (7)
1以上のバンドルを有するバンドル群に利用が許可されたメモリ量の情報を記憶手段から読み出して、当該メモリ量と同じ大きさのヒープ領域を確保する要求を行うメモリ管理バンドルと、
自機のヒープ領域から前記ヒープ領域を確保し、前記バンドル群が利用するメモリ領域を、当該ヒープ領域に割り当てるJava仮想マシンと、を有し、
前記バンドル群を複数備え、当該複数のバンドル群は、あるスレッドにおいて呼び出し・呼び出される関係を有し、
前記メモリ管理バンドルは、
最初に呼び出しを行ったバンドル群のみについて前記要求を行い、当該バンドル群以外のバンドル群については前記要求を行わず、
前記Java仮想マシンは、
全てのバンドル群が利用するメモリ領域を、最初に呼び出しを行ったバンドル群に対して確保されたヒープ領域に割り当てることを特徴とするメモリ管理装置。 In a memory management device that manages memory used by a bundle based on the OSGi standard specification,
A memory management bundle that reads out information on the amount of memory permitted to be used for a bundle group having one or more bundles from the storage unit, and makes a request to secure a heap area having the same size as the amount of memory;
A Java virtual machine that secures the heap area from its own heap area and allocates a memory area used by the bundle group to the heap area;
A plurality of the bundle groups, the plurality of bundle groups have a relationship to be called and called in a certain thread,
The memory management bundle is
The request is made only for the bundle group that made the call first, and the request is not made for bundle groups other than the bundle group,
The Java virtual machine is
A memory management device characterized by allocating a memory area used by all bundle groups to a heap area reserved for a bundle group that is first called.
1以上のバンドルを有するバンドル群に利用が許可されたメモリ量の情報を記憶手段から読み出して、当該メモリ量と同じ大きさのヒープ領域を確保する要求を行うメモリ管理バンドルと、
自機のヒープ領域から前記ヒープ領域を確保し、前記バンドル群が利用するメモリ領域を、当該ヒープ領域に割り当てるJava仮想マシンと、を有し、
前記バンドル群を複数備え、当該複数のバンドル群は、あるスレッドにおいてバンドルの有する機能の提供・利用の関係を有する機能提供バンドル群および機能利用バンドル群であって、
前記メモリ管理バンドルは、
前記機能利用バンドル群のみについて前記要求を行い、前記機能提供バンドル群については前記要求を行わず、
前記Java仮想マシンは、
前記機能提供バンドル群が利用するメモリ領域を、前記機能利用バンドル群に対して確保されたヒープ領域に割り当てることを特徴とするメモリ管理装置。 In a memory management device that manages memory used by a bundle based on the OSGi standard specification,
A memory management bundle that reads out information on the amount of memory permitted to be used for a bundle group having one or more bundles from the storage unit, and makes a request to secure a heap area having the same size as the amount of memory;
A Java virtual machine that secures the heap area from its own heap area and allocates a memory area used by the bundle group to the heap area;
The bundle group includes a plurality of bundle groups, and the bundle groups are a function providing bundle group and a function using bundle group that have a relationship of providing and using functions of the bundle in a certain thread,
The memory management bundle is
Make the request only for the function use bundle group, do not make the request for the function provision bundle group,
The Java virtual machine is
A memory management device, wherein a memory area used by the function providing bundle group is allocated to a heap area reserved for the function using bundle group.
コンピュータにより、
1以上のバンドルを有するバンドル群に利用が許可されたメモリ量の情報を記憶手段から読み出して、当該メモリ量と同じ大きさのヒープ領域を確保する要求を行う第1ステップと、
自機のヒープ領域から前記ヒープ領域を確保し、前記バンドル群が利用するメモリ領域を、当該ヒープ領域に割り当てる第2ステップと、を有し、
前記バンドル群を複数備え、当該複数のバンドル群は、あるスレッドにおいて呼び出し・呼び出される関係を有し、
前記第1ステップは、
最初に呼び出しを行ったバンドル群のみについて前記要求を行い、当該バンドル群以外のバンドル群については前記要求を行わず、
前記第2ステップは、
全てのバンドル群が利用するメモリ領域を、最初に呼び出しを行ったバンドル群に対して確保されたヒープ領域に割り当てることを特徴とするメモリ管理方法。 In a memory management method for managing memory used by a bundle based on the OSGi standard specification,
By computer
A first step of reading out information on a memory amount permitted to be used for a bundle group having one or more bundles from a storage unit, and making a request to secure a heap area having the same size as the memory amount;
Securing the heap area from its own heap area, and allocating a memory area used by the bundle group to the heap area, and
A plurality of the bundle groups, the plurality of bundle groups have a relationship to be called and called in a certain thread,
The first step includes
The request is made only for the bundle group that made the call first, and the request is not made for bundle groups other than the bundle group,
The second step includes
A memory management method characterized by allocating a memory area used by all bundle groups to a heap area reserved for a bundle group that is first called.
コンピュータにより、
1以上のバンドルを有するバンドル群に利用が許可されたメモリ量の情報を記憶手段から読み出して、当該メモリ量と同じ大きさのヒープ領域を確保する要求を行う第1ステップと、
自機のヒープ領域から前記ヒープ領域を確保し、前記バンドル群が利用するメモリ領域を、当該ヒープ領域に割り当てる第2ステップと、を有し、
前記バンドル群を複数備え、当該複数のバンドル群は、あるスレッドにおいてバンドルの有する機能の提供・利用の関係を有する機能提供バンドル群および機能利用バンドル群であって、
前記第1ステップは、
前記機能利用バンドル群のみについて前記要求を行い、前記機能提供バンドル群については前記要求を行わず、
前記第2ステップは、
前記機能提供バンドル群が利用するメモリ領域を、前記機能利用バンドル群に対して確保されたヒープ領域に割り当てることを特徴とするメモリ管理方法。 In a memory management method for managing memory used by a bundle based on the OSGi standard specification,
By computer
A first step of reading out information on a memory amount permitted to be used for a bundle group having one or more bundles from a storage unit, and making a request to secure a heap area having the same size as the memory amount;
Securing the heap area from its own heap area, and allocating a memory area used by the bundle group to the heap area, and
The bundle group includes a plurality of bundle groups, and the bundle groups are a function providing bundle group and a function using bundle group that have a relationship of providing and using functions of the bundle in a certain thread,
The first step includes
Make the request only for the function use bundle group, do not make the request for the function provision bundle group,
The second step includes
A memory management method, comprising: allocating a memory area used by the function providing bundle group to a heap area reserved for the function using bundle group.
前記機能提供バンドル群は、機能を提供するサービス事業者により生成されたバンドル群であり、前記機能利用バンドル群は、機能を利用するサービス事業者により生成されたバンドル群であることを特徴とする請求項4記載のメモリ管理方法。The function provision bundle group is a bundle group generated by a service provider that provides a function, and the function use bundle group is a bundle group generated by a service provider that uses a function. The memory management method according to claim 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011083620A JP5684633B2 (en) | 2011-04-05 | 2011-04-05 | Memory management device, memory management method, and memory management program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011083620A JP5684633B2 (en) | 2011-04-05 | 2011-04-05 | Memory management device, memory management method, and memory management program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2012221034A JP2012221034A (en) | 2012-11-12 |
JP5684633B2 true JP5684633B2 (en) | 2015-03-18 |
Family
ID=47272527
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011083620A Expired - Fee Related JP5684633B2 (en) | 2011-04-05 | 2011-04-05 | Memory management device, memory management method, and memory management program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5684633B2 (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5357989B2 (en) * | 2012-02-27 | 2013-12-04 | 日本電信電話株式会社 | Memory management device, memory management method, and memory management program |
JP6191177B2 (en) * | 2013-03-15 | 2017-09-06 | 株式会社リコー | Information processing apparatus, information processing system, information processing method, information processing program, and recording medium |
JP6069107B2 (en) * | 2013-06-10 | 2017-01-25 | 一般財団法人電力中央研究所 | Bundle control method and bundle control device |
JP6682599B2 (en) * | 2018-10-19 | 2020-04-15 | イーソル株式会社 | Operating system and memory allocation method |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000285010A (en) * | 1999-03-30 | 2000-10-13 | Japan Research Institute Ltd | Medium recording program for checking operating memory capacity of application |
JP4504756B2 (en) * | 2004-07-26 | 2010-07-14 | 株式会社アプリックス | Memory management method and memory management program in Java (registered trademark) execution environment |
JP2009134379A (en) * | 2007-11-29 | 2009-06-18 | Hitachi Ltd | Memory management method |
-
2011
- 2011-04-05 JP JP2011083620A patent/JP5684633B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2012221034A (en) | 2012-11-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9400686B2 (en) | Process grouping for improved cache and memory affinity | |
CN113243005A (en) | Performance-based hardware emulation in on-demand network code execution systems | |
US7827374B2 (en) | Relocating page tables | |
CN110120940B (en) | File system resource isolation method for Docker container | |
US8176142B2 (en) | Shared JAVA jar files | |
US20110154378A1 (en) | Api namespace virtualization | |
US10102047B2 (en) | In-memory data analytic system that provides an integrated tracking mechanism for explicit memory resources | |
US9542228B2 (en) | Image processing apparatus, control method thereof and storage medium | |
US8650537B2 (en) | Optimizing an object-oriented program by transforming invocations of synthetic accessor methods | |
US20100017515A1 (en) | Resource migration system and resource migration method | |
US11556468B2 (en) | Multi-ring shared, traversable, and dynamic advanced database | |
JP5684633B2 (en) | Memory management device, memory management method, and memory management program | |
JP2008234191A (en) | Hardware monitor management device and method of executing hardware monitor function | |
WO2020192705A1 (en) | Class loading method and apparatus | |
US8694972B2 (en) | System and method for interoperating with foreign objects from a single language computing environment | |
CN113010265A (en) | Pod scheduling method, scheduler, memory plug-in and system | |
JP2010272090A (en) | Device, program and method for managing processing request destination | |
CN110795454A (en) | Service request method, device, server and storage medium | |
CN105677481A (en) | Method and system for processing data and electronic equipment | |
JP4862056B2 (en) | Virtual machine management mechanism and CPU time allocation control method in virtual machine system | |
JP6418419B2 (en) | Method and apparatus for hard disk to execute application code | |
US20200192712A1 (en) | Region to host affinity for block allocation in clustered file system volume | |
JP5357989B2 (en) | Memory management device, memory management method, and memory management program | |
JP2016051395A (en) | Image forming apparatus and resource management method | |
US6915408B2 (en) | Implementation of thread-static data in multi-threaded computer systems |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20130813 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20140122 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20140304 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140414 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20140909 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20141027 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20141125 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20141217 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20150113 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20150115 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5684633 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |