<p><a href="https://github.com/adamdanischewski" class="user-mention">@AdamDanischewski</a> as was said on <a href="https://github.com/geany/geany/issues/1540" class="issue-link js-issue-link" data-url="https://github.com/geany/geany/issues/1540" data-id="242795101" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#1540</a>, Geany's use-case is for editing human program source files, it assumes they are reasonably sized and loads the whole file and keeps style information for the whole file so it doesn't have to be regenerated all the time (hence twice the size).  If Geany's use-case was to open the biggest possible file it may be designed differently and would not use Scintilla.  That is unlikely to change.</p>
<p>In general its not possible to warn if a program is "running out of memory" before it does (ie an allocate fails) because that can depend on what else is using memory.  Its not even possible to report if a program is running out of address space (which is actually what the 32bit windows problem is) because many library functions use memory that Geany has no idea about.</p>
<p>The best we can do is as I posted above, don't crash/hang when an allocate fails (but obviously don't complete the operation that was happening) and let the user try saving their files, it may still work if the allocate that failed was very large and the files they want to save are small.</p>
<p><a href="https://github.com/codebrainz" class="user-mention">@codebrainz</a> yeah, Geany does check the error return from <code>g_file_load_contents()</code> and simply does nothing if it fails :)</p>
<p>This issue is however intended to be solely about Scintilla status returns, but I'm sure more issues could be raised for other places return checks are missed.</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-320130010">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ_WC_MfoO_U4Q9JPWvQmcXgEpWx0ks5sUm_GgaJpZM4OtGp5">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ_7o2FoB7yynTJyneBtPohuOZzjSks5sUm_GgaJpZM4OtGp5.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-320130010"></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":"@elextr in #1569: @AdamDanischewski as was said on #1540, Geany's use-case is for editing human program source files, it assumes they are reasonably sized and loads the whole file and keeps style information for the whole file so it doesn't have to be regenerated all the time (hence twice the size).  If Geany's use-case was to open the biggest possible file it may be designed differently and would not use Scintilla.  That is unlikely to change.\r\n\r\nIn general its not possible to warn if a program is \"running out of memory\" before it does (ie an allocate fails) because that can depend on what else is using memory.  Its not even possible to report if a program is running out of address space (which is actually what the 32bit windows problem is) because many library functions use memory that Geany has no idea about.\r\n\r\nThe best we can do is as I posted above, don't crash/hang when an allocate fails (but obviously don't complete the operation that was happening) and let the user try saving their files, it may still work if the allocate that failed was very large and the files they want to save are small.\r\n\r\n@codebrainz yeah, Geany does check the error return from `g_file_load_contents()` and simply does nothing if it fails :)\r\n\r\nThis issue is however intended to be solely about Scintilla status returns, but I'm sure more issues could be raised for other places return checks are missed."}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1569#issuecomment-320130010"}}}</script>