<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Memory Allocation - FATAL ERROR in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155220#M15468</link>
    <description>&lt;P&gt;Unrelated to the problem. Thanks for posting though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A single memory allocation fails at the same threshold.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess, there's something going on with AutoCAD and memory management under the hood. The behavior of the application on failure to allocate is not a standard operating system response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I'm surprised by the failure to allocate and return a valid pointer. 100MB is not much memory these days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Roger&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2011 04:50:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-09-13T04:50:48Z</dc:date>
    <item>
      <title>Memory Allocation - FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155044#M15465</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've written a simple ARX utility that does nothing but allocate and free a block of memory off the heap.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It uses the C++ new and delete operators, and successively increases the size of the block 1MB at a time, running until AutoCAD crashes.&lt;BR /&gt;&lt;BR /&gt;AutoCAD crashes after allocating 83MB of memory. "FATAL ERROR: Out of Memory - Shutting Down"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test environment: AutoCAD 2011 on XP (Win32) with 3GB of memory (1.85GB physical RAM available).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the C code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; 1000; i++)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int len = i * 1000000;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char* buffer = new char[len];&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (buffer) delete []buffer;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Any insights?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Roger﻿&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2011 23:08:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155044#M15465</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-12T23:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation - FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155140#M15466</link>
      <description>&lt;P&gt;I should clarify the point of my post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The crash occurs at 83MB on a machine with 1.83GB RAM available.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's a very small amount of memory nowadays. A wee bit of RAM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would not expect the entire program to abort and shut down.&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;Any insights?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2011 01:47:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155140#M15466</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-13T01:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation - FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155166#M15467</link>
      <description>You are assuming that every new allocation re-uses the previously freed memory. Your results prove that the assumption is incorrect.</description>
      <pubDate>Tue, 13 Sep 2011 02:51:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155166#M15467</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2011-09-13T02:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation - FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155220#M15468</link>
      <description>&lt;P&gt;Unrelated to the problem. Thanks for posting though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A single memory allocation fails at the same threshold.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess, there's something going on with AutoCAD and memory management under the hood. The behavior of the application on failure to allocate is not a standard operating system response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I'm surprised by the failure to allocate and return a valid pointer. 100MB is not much memory these days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Roger&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2011 04:50:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155220#M15468</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-13T04:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation - FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155332#M15469</link>
      <description>&lt;P&gt;Testing allocation limits under ARX:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; 1MB / alloc =&amp;gt; Up to 900MB&lt;BR /&gt;&amp;nbsp;10MB / alloc =&amp;gt; Up to 700MB&lt;BR /&gt;&amp;nbsp;20MB / alloc =&amp;gt; Up to 520MB&lt;BR /&gt;&amp;nbsp;30MB / alloc =&amp;gt; Up to 420MB&lt;BR /&gt;&amp;nbsp;40MB / alloc =&amp;gt; Up to 320MB&lt;BR /&gt;&amp;nbsp;50MB / alloc =&amp;gt; Up to 350MB&lt;BR /&gt;&amp;nbsp;60MB / alloc =&amp;gt; Up to 300MB&lt;BR /&gt;&amp;nbsp;70MB / alloc =&amp;gt; Up to 140MB&lt;BR /&gt;&amp;nbsp;80MB / alloc =&amp;gt; Up to 160MB&lt;BR /&gt;&amp;nbsp;90MB / alloc =&amp;gt; FAIL&lt;BR /&gt;&lt;BR /&gt;These are small numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Contiguous memory available for heap requests is ample.&lt;BR /&gt;&lt;BR /&gt;On the same machine, heap allocation limits outside ARX:&lt;BR /&gt;&lt;BR /&gt;100MB / alloc =&amp;gt; Up to 1.8GB&lt;BR /&gt;200MB / alloc =&amp;gt; Up to 1.8GB&lt;BR /&gt;300MB / alloc =&amp;gt; Up to 1.8GB&lt;BR /&gt;...&lt;BR /&gt;600MB / alloc =&amp;gt; Up to 1.8GB&lt;BR /&gt;&lt;BR /&gt;- Why does the heap behave differently under ARX?&lt;BR /&gt;&lt;BR /&gt;- Does AutoCAD limit the size of the process heap?&lt;BR /&gt;&lt;BR /&gt;- Is it using private heaps for memory management?&lt;BR /&gt;&lt;BR /&gt;- Does it override the new operator / malloc function?&lt;BR /&gt;&lt;BR /&gt;- Why is there a custom new handler on malloc failure?&lt;BR /&gt;&lt;BR /&gt;Feedback welcome. Thanks.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Roger&lt;BR /&gt;﻿&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2011 07:40:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3155332#M15469</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-13T07:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation - FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3162716#M15470</link>
      <description>&lt;P&gt;It appears that your first loop code is a good approximation of a memory fragmenter. However, the allocation limit testing is interesting, and I'm glad you brought it up, since I'm curious to know why this is the case as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2011 15:16:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3162716#M15470</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-19T15:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation - FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3162858#M15471</link>
      <description>&lt;P&gt;Yes, the original problem surfaced in a very simple heap context, no fragmentation issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Modern hardware, 1.8 GB physical memory available, allocating 85MB shouldn't be a problem, IMHO.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We test for malloc failure in our code, handle gracefully with a dialog box to the user, but we never ﻿actually get to that point because AutoCAD pops up its own dialog box on malloc failure: FATAL ERROR - Out of Memory, abort the program, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the interest in this topic.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2011 16:53:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/memory-allocation-fatal-error/m-p/3162858#M15471</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-19T16:53:22Z</dc:date>
    </item>
  </channel>
</rss>

