chatty.github.io/help/help-memory_usage.html
2017-05-27 20:48:54 +02:00

56 lines
2.9 KiB
HTML

<!DOCTYPE html>
<html>
<title>Chatty Help</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<body>
<div id="backlink"><a href="help.html">Back to main help page</a></div>
<h1><a name="top">Memory Usage</a></h1>
<p>
<a href="#restrict">Restrict Memory Usage</a> |
<a href="#error">OutOfMemoryError</a>
</p>
<p>The programs memory is managed by Java, which means Java allocates a
certain amount of memory which is then filled up with data of the program
and once Java decides so, it cleans up data that is not used anymore
(Garbage Collection). This leads to the actual memory usage going up and
down constantly, while the allocated memory mostly stays the same. So
even if only 50 MB are filled with data by the program <em>at the time</em>, Java may
still have 200 MB reserved to optimize Gargabe Collection. Thus, the memory usage in e.g. the Task Manager
may not reflect what the program actually <em>requires</em>, just how
much Java uses.</p>
<p>Use the <code>/appinfo</code> command in Chatty to get some information
about the current memory usage.</p>
<p>A typical memory usage pattern, which can change over time as the program
is running while Java optimizes Gargabe Collection:<br />
<img src="jconsole.jpg" alt="Typical memory usage pattern" /></p>
<h2><a name="restrict">Restrict Memory Usage</a></h2>
<p>You can <a href="http://stackoverflow.com/questions/1493913/how-to-set-the-maximum-memory-usage-for-jvm">restrict</a> how much memory Java is allowed to use by specifying
commandline parameters for Java. <a href="help-guide_create_shortcut.html">Create a shortcut</a>
and add the appropriate parameter after the <code>javaw.exe</code> but
before the <code>-jar</code> parameter.</p>
<p>For example to restrict memory to 150 MB: <code>javaw -Xmx150M -jar "D:\Chatty\Chatty.jar"</code>.
You should test out yourself how low you can go, although more than 100 MB
is usually recommended. Note that Java will show a higher usage than
this in the Task Manager, since this pretty much only restricts how much
the program can store, Java will need some more for it's own management
and data.</p>
<p>For the Windows Standalone version you can add this value to the file
<code>&lt;path to Chatty&gt;/app/Chatty.cfg</code>.</p>
<h2><a name="error">OutOfMemoryError</a></h2>
<p>If you get an OutOfMemoryError then Java ran out of memory. This can
either be because it simply can't allocate enough memory (at least 100 MB is recommended)
or there is a bug that prevents it from cleaning up memory that is not
actually used anymore. These kinds of bugs are pretty difficult to track
down though, especially if they only occur somewhat randomly.</p>
</body>
</html>