Adjusting the operating memory used by a virtual machine during runtime
AssigneeRed Hat, Inc.
InventorsMarek Baluch, Jiri Sedlacek
Life of this patent
Estimating the term…
Abstract
A method comprising executing an application on a JAVA virtual machine, the JAVA virtual machine executing on a computing device, the application having allocated memory, monitoring, by the JAVA virtual machine, memory consumed by the application during execution, determining, based on the consumed memory, that the allocated memory is to be adjusted; and adjusting, by the JAVA virtual machine, the allocated memory during runtime without restarting the execution of the application.
Claims11
A method comprising:
- executing, by a processing device, an application on a Java virtual machine (JVM), the JVM executed by the processing device on a computing device, the application having allocated memory;
- monitoring, by the JVM, memory consumed by the application during execution, wherein the monitoring of the memory consumed by the application comprises monitoring a current state of the application, the current state of the application being represented by a loaded bytecode of the application, a method area of the application, a stack of the application and a heap of the application;
- determining, by the JVM, whether the memory consumed by the application during execution is below a threshold, wherein determining whether the memory consumed by the application is below the threshold comprises comparing each of a size of the loaded bytecode of the application, a size of the method area of the application, a size of the stack of the application and a size of the heap of the application with the threshold, and determining whether any of the size of the loaded bytecode of the application, the size of the method area of the application, the size of the stack of the application or the size of the heap of the application is below the threshold in view of the comparing;
- responsive to determining that the memory consumed by the application during execution is below the threshold, sending, by the JVM, a request to an operating system to adjust a size of the allocated memory, wherein the sending comprises providing, by the JVM, a notification to the operating system to request the operating system to reallocate an excess in the allocated memory associated with the application, wherein the monitoring, the determining, and the sending are performed automatically;
- receiving, from the operating system, a message indicating that the size of the allocated memory has been adjusted by the operating system;
- and
- responsive to receiving the message, adjusting, by the JVM, a state of the application during runtime without restarting the execution of the application, wherein the adjusting comprises:
- decreasing a maximum boundary of the heap of the application in view of the excess in the allocated memory.
A non-transitory computer readable storage medium including instructions that, when executed by a processing device, cause the processing device to:
- execute an application on a Java virtual machine (JVM), the JVM executed by the processing device on a computing device, the application having allocated memory;
- monitor, by the JVM, memory consumed by the application during execution, wherein to monitor the memory consumed by the application during execution is to monitor a current state of the application, the current state of the application being represented by a loaded bytecode of the application, a method area of the application, a stack of the application and a heap of the application,
- determine, by the JVM, whether the memory consumed by the application during execution is below a threshold, wherein determining whether the memory consumed by the application is below the threshold comprises comparing each of a size of the loaded bytecode of the application, a size of the method area of the application, a size of the stack of the application and a size of the heap of the application with the threshold, and determining whether any of the size of the loaded bytecode of the application, the size of the method area of the application, the size of the stack of the application or the size of the heap of the application is below the threshold in view of the comparing;
- responsive to determining that the memory consumed by the application during execution is below the threshold, send, by the JVM, a request to an operating system to adjust a size of the allocated memory, wherein the sending comprises providing, by the JVM, a notification to the operating system to request the operating system to reallocate an excess in the allocated memory associated with the application, wherein the monitoring, the determining, and the sending are performed automatically;
- receive, from the operating system, a message indicating that the size of the allocated memory has been adjusted by the operating system;
- and
- responsive to receiving the message, adjust, by the JVM, a state of the application during runtime without restarting the execution of the application, wherein to adjust, the processing device to:
- decrease a maximum boundary of the heap of the application in view of the excess in the allocated memory.
An apparatus comprising:
- a memory;
- and
- a processing device communicably coupled to the memory, the processing device to execute a Java virtual machine (JVM) to:
- execute an application on the JVM, the application having allocated memory;
- monitor memory consumed by the application during execution, wherein to monitor the memory consumed by the application during execution, is to monitor a current state of the application, the current state of the application being represented by a loaded bytecode of the application, a method area of the application, a stack of the application and a heap,
- determine whether the memory consumed by the application during execution is below a threshold, wherein to determine whether the memory consumed by the application is below the threshold, the processing device is to compare each of a size of the loaded bytecode of the application, a size of the method area of the application, a size of the stack of the application and a size of the heap of the application with the threshold, and to determine whether any of the size of the loaded bytecode of the application, the size of the method area of the application, the size of the stack of the application or the size of the heap of the application is below the threshold in view of the comparing;
- responsive to determining that memory consumed by the application during execution is below the threshold, send a request to an operating system to adjust a size of the allocated memory, wherein to send the request to the operating system, the processing device is to provide, via the JVM, a notification to the operating system to request the operating system to reallocate an excess in the allocated memory associated with the application, wherein the processing device is to perform the monitoring, the determining, and the sending automatically;
- receive, from the operating system, a message indicating that the size of the allocated memory has been adjusted by the operating system;
- and
- responsive to receiving the message, adjust a state of the application during runtime without restarting the execution of the application, wherein to adjust, the processing device to:
- decrease a maximum boundary the of the application in view of the excess in the allocated memory.
Dependencies are inferred from the claim text.