<p>I don't have much time - but if anyone wants to take a crack at finding sensible settings for a healthy memory reserve threshold, to preclude freezes and data loss. I took a quick look via strace, and a strace output parser I found (<a href="https://github.com/gmarcais/memtrace">https://github.com/gmarcais/memtrace</a>), here is what my system looks like for my typical use:</p>
<pre><code>$> strace -e trace=memory geany &> /tmp/mystrace.txt
$> ./memtrace.rb -f /tmp/mystrace.txt 
      max: heap    7675904  (7.32M) mmap   17944616  (17.1M) vm   25620520  (24.4M)
</code></pre>
<p>So, for my typical use case having around 50MB should cover what is actually required - but the healthy buffer itself is beyond what is required to run so adding a few more MB (~5MB) should normally be okay. If the user strays outside of the healthy reserve then Geany/Scintilla should try to allocate what will be required + however much more to get back the healthy buffer. If Geany cannot allocate the memory for both then a warning should be thrown telling the user of the situation and allowing the user to take corrective measures (e.g. saving) and preclude data loss.</p>
<p>So to be clear the healthy buffer is not necessarily stopping the user from any operations, it is simply a safety margin to allow for saves and clean shutdown of what Geany is already dealing with <em>before</em>  Geany actually runs out of memory.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/1569#issuecomment-320150354">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ-LeMHbH24-TPsVOYdmj1lAMfBf5ks5sUpbzgaJpZM4OtGp5">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ4BKr2Ud2iyKLh3AlZgNIZYNaFZBks5sUpbzgaJpZM4OtGp5.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/issues/1569#issuecomment-320150354"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"PERSON","message":"@AdamDanischewski in #1569: I don't have much time - but if anyone wants to take a crack at finding sensible settings for a healthy memory reserve threshold, to preclude freezes and data loss. I took a quick look via strace, and a strace output parser I found (https://github.com/gmarcais/memtrace), here is what my system looks like for my typical use: \r\n```\r\n$\u003e strace -e trace=memory geany \u0026\u003e /tmp/mystrace.txt\r\n$\u003e ./memtrace.rb -f /tmp/mystrace.txt \r\n      max: heap    7675904  (7.32M) mmap   17944616  (17.1M) vm   25620520  (24.4M)\r\n```\r\nSo, for my typical use case having around 50MB should cover what is actually required - but the healthy buffer itself is beyond what is required to run so adding a few more MB (~5MB) should normally be okay. If the user strays outside of the healthy reserve then Geany/Scintilla should try to allocate what will be required + however much more to get back the healthy buffer. If Geany cannot allocate the memory for both then a warning should be thrown telling the user of the situation and allowing the user to take corrective measures (e.g. saving) and preclude data loss. \r\n\r\nSo to be clear the healthy buffer is not necessarily stopping the user from any operations, it is simply a safety margin to allow for saves and clean shutdown of what Geany is already dealing with *before*  Geany actually runs out of memory. "}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1569#issuecomment-320150354"}}}</script>