.. _Memory Monitor:

Memory Monitor
==============


The Memory Monitor keeps track of the memory usage during memory intensive operations such as **Build**, **Linting (Verissimo)**, **UVM Runtime Elaboration** and **Documentation Generation (Specador)** and notifies you when:

-  The operation in progress is significantly slowed down by low memory:

.. figure:: ../../images/common/memory_monitor_warning_console_message.png
	:align: center


-  A memory starvation state is reached

.. figure:: ../../images/common/memory_monitor_error_console_message.png
	:align: center


.. note:: 

 Memory starvation happens when a Java-based application such as DVT, Verissimo or Specador struggles to cope with insufficient memory and ultimately leads to major performance degradation. This can easily be fixed by allocating enough memory to fit the project's size.

Such messages will be printed to console - see :ref:`Output and logging`.
In the DVT IDE for Eclipse you will also get feedback via:

-  a pop-up notification

.. figure:: ../../images/common/memory_monitor_warning_popup.png
	:align: center


.. figure:: ../../images/common/memory_monitor_error_popup.png
	:align: center

-  a problem in the Problems View

.. figure:: ../../images/common/memory_monitor_warning_problems_view.png
	:align: center


.. figure:: ../../images/common/memory_monitor_error_problems_view.png
	:align: center


You can disable the warning notifications by:

- checking the "Don't show again" option from the pop-up notification
- un-checking the "Display Memory Warning" from :menuselection:`Window --> Preferences --> DVT --> Memory Monitor`.

.. figure:: ../../images/common/memory_monitor_preference_page.png
	:align: center


To disable the Memory Monitor, add the ``+dvt_disable_memory_starvation_handling`` directive in the build configuration file.

To generate Memory Monitor debug information, add the ``+dvt_enable_memory_starvation_handling_debug`` directive in the build configuration file.
Afterwards, the next monitoring session will generate a log file ``+dvt_memory_monitor_<timestamp>.log`` in the project's .dvt/profiling/memory_monitor/ directory.

By default, when memory usage exceeds 80% a warning is issued, and when significant performance degradation is observed due to excessive GC, the monitored operation is stopped.

Use ``+dvt_memory_starvation_handling`` to select a different memory starvation handling strategy. Available are:

-  **proactive** - warnings disabled, stops the monitored operation when it detects memory usage above 80%. Example: +dvt_enable_memory_starvation_handling+proactive

.. note:: 

	For advanced debugging, you can control Memory Monitor parameters using the following directive:

	.. code-block::

		+dvt_set_memory_starvation_handling_parameters+start_delay=<time_in_ms>+warning_th=<used_mem_percent>+gc_time=<gc_percent_time>+time_window=<build_time_percent>+stop_operation_th=<stop_operation_percentage>+ignoreWarning

