title: Delphi 10.3: unable to open DFM in IDE, out of memory
body: <p>I'm developing a project in Delphi Rio 10.3 Community and it currently has 24 units. This particular form I'm having problems with contains 28 frames of the same type, each containing a TChart component with a few buttons and checkboxes (print chart, show/hide series/labels, etc.). Everything was fine until about 20-25 frames/charts, but yesterday I added a couple more till I reached 28. No errors whatsoever at design nor run-time, so I closed Delphi happily at the end of the day.</p>
  
  <p>Problem started next time I started Delphi. The exact error I'm getting when I simply open my project is "Error creating form: Out of memory." After acknowledging the error the project still opens fine, except for this particular DFM file with 28 frames/charts. I can still compile and run the project without any issues, but I can't visualize the form in the IDE in order to develop it further.</p>
  
  <p>I understand I reached some kind of limitation, although the project/form is not huge. I have an i7 with 32GB memory, Windows shows I have 26GB free, so I think that's plenty.</p>
  
  <p>I didn't find any reference to this exact error message on the web, but some similar compiler error, which is not my case:</p>
  
  <p><a href="http://docwiki.embarcadero.com/RADStudio/Rio/en/F2046_Out_of_memory_(Delphi)" rel="nofollow noreferrer">http://docwiki.embarcadero.com/RADStudio/Rio/en/F2046_Out_of_memory_(Delphi)</a></p>
  
  <p>However, I did try the workaround with increasing the swap file size in Windows, but no luck.</p>
  
  <p>I also installed the latest IDE Fix Pack 6.4.2 from Andy, again no success:</p>
  
  <p><a href="https://andy.jgknet.de/blog/ide-tools/ide-fix-pack/" rel="nofollow noreferrer">https://andy.jgknet.de/blog/ide-tools/ide-fix-pack/</a></p>
  
  <p>DFM file has around 3000 lines, so pasting only one of the 28 frames/charts in it:</p>
  
  <pre><code>    inline FrameSmartChart1: TFrameSmartChart
        Left = 50
        Top = 800
        Width = 450
        Height = 250
        TabOrder = 2
        ExplicitLeft = 50
        ExplicitTop = 800
        inherited Chart1: TChart
          Title.Text.Strings = (
            'Incoming Calls From MSCs')
          PrintMargins = (
            15
            22
            15
            22)
          inherited Label0: TLabel
            Width = 52
            Hint = 'Voice-Charging-Originating-Call'
            Caption = 'Originating'
            ExplicitWidth = 52
          end
          inherited Label1: TLabel
            Width = 52
            Hint = 'Voice-Charging-Forwarding-Call'
            Caption = 'Forwarded'
            ExplicitWidth = 52
          end
          inherited Label2: TLabel
            Width = 56
            Hint = 'Voice-Charging-Terminating-Call'
            Caption = 'Terminating'
            ExplicitWidth = 56
          end
          inherited CheckBox2: TCheckBox
            Hint = 'Voice-Charging-Terminating-Call'
          end
          inherited CheckBox1: TCheckBox
            Hint = 'Voice-Charging-Forwarding-Call'
          end
          inherited CheckBox0: TCheckBox
            Hint = 'Voice-Charging-Originating-Call'
          end
          inherited Series3: TBarSeries
            BarStyle = bsRectangle
          end
        end
      end
  </code></pre>
  
  <p>The unit header:</p>
  
  <pre><code>unit CCN;
  
  interface
  
  uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    ExtCtrls, ComCtrls, StdCtrls, NodeClasses, NSPmagazine, NSP,
    OleCtrls, TSP, Linux, Services, SmartChart, DB,
    ZAbstractRODataset, ZAbstractDataset, ZAbstractTable, ZDataset,
    ZConnection, ZAbstractConnection;
  
  type TCCN = class(TNode)
      procedure GetConfig;   override;
      procedure GetStatus;   override;
      procedure GetCounters; override;
  
  private
      procedure PlotCountersDBRowToCharts(ZQuery: TZQuery);
  end;
  
  type
    TFrameCCN = class(TFrame)
      PageControl1: TPageControl;
      TabSheet1: TTabSheet;
      TabSheet2: TTabSheet;
      TabSheet3: TTabSheet;
      TabSheet4: TTabSheet;
      Panel1: TPanel;
      FrameNSP: TFrameNSP;
      FrameTSP: TFrameTSP;
      Label1: TLabel;
      Edit1: TEdit;
      FrameLinux: TFrameLinux;
      Label2: TLabel;
      RichEdit1: TRichEdit;
      TabSheet5: TTabSheet;
      Frame51: TFrame5;
      PageControl2: TPageControl;
      TabSheet6: TTabSheet;
      TabSheet7: TTabSheet;
      TabSheet8: TTabSheet;
      TabSheet9: TTabSheet;
      ZConnection1: TZConnection;  
      ZQueryCounters: TZQuery;     
      ZQueryCountersHistory: TZQuery;
      ScrollBox1: TScrollBox;
      DateTimePickerFirst: TDateTimePicker;
      DateTimePickerLast: TDateTimePicker;
      FrameSmartChart1: TFrameSmartChart;
      FrameSmartChart2: TFrameSmartChart;
      FrameSmartChart3: TFrameSmartChart;
      FrameSmartChart4: TFrameSmartChart;
      FrameSmartChart5: TFrameSmartChart;
      FrameSmartChart6: TFrameSmartChart;
      FrameSmartChart7: TFrameSmartChart;
      FrameSmartChart8: TFrameSmartChart;
      FrameSmartChart9: TFrameSmartChart;
      FrameSmartChart10: TFrameSmartChart;
      FrameSmartChart11: TFrameSmartChart;
      Shape1: TShape;
      Shape3: TShape;
      Shape4: TShape;
      Shape5: TShape;
      Shape6: TShape;
      Shape7: TShape;
      FrameSmartChart12: TFrameSmartChart;
      FrameSmartChart13: TFrameSmartChart;
      Shape8: TShape;
      Shape9: TShape;
      Shape10: TShape;
      Shape11: TShape;
      Shape12: TShape;
      Shape13: TShape;
      Shape14: TShape;
      Shape15: TShape;
      Shape16: TShape;
      Shape17: TShape;
      Shape18: TShape;
      Shape19: TShape;
      Shape20: TShape;
      Shape21: TShape;
      Shape22: TShape;
      Shape23: TShape;
      Shape24: TShape;
      Shape25: TShape;
      Shape26: TShape;
      Shape27: TShape;
      Shape28: TShape;
      FrameSmartChart14: TFrameSmartChart;
      Shape29: TShape;
      ScrollBox2: TScrollBox;
      FrameSmartChart15: TFrameSmartChart;
      FrameSmartChart16: TFrameSmartChart;
      FrameSmartChart17: TFrameSmartChart;
      FrameSmartChart18: TFrameSmartChart;
      FrameSmartChart19: TFrameSmartChart;
      FrameSmartChart20: TFrameSmartChart;
      Shape2: TShape;
      FrameSmartChart21: TFrameSmartChart;
      FrameSmartChart22: TFrameSmartChart;
      FrameSmartChart23: TFrameSmartChart;
      FrameSmartChart24: TFrameSmartChart;
      Shape30: TShape;
      Shape31: TShape;
      Shape32: TShape;
      Shape33: TShape;
      Shape34: TShape;
      Shape35: TShape;
      Shape36: TShape;
      Shape37: TShape;
      Shape38: TShape;
      Shape39: TShape;
      Shape40: TShape;
      Shape41: TShape;
      TabSheet10: TTabSheet;
      ScrollBox3: TScrollBox;
      FrameSmartChart25: TFrameSmartChart;
      FrameSmartChart26: TFrameSmartChart;
      Shape42: TShape;
      Shape43: TShape;
      FrameSmartChart27: TFrameSmartChart;
      Shape44: TShape;
      FrameSmartChart28: TFrameSmartChart;
      Shape45: TShape;
    private
      { Private declarations }
    public
    end;
  
  implementation
  
  {$R *.dfm}
  
  uses SSH, NOCMagic, NSPprocessor, Log, DateUtils, SqlTimSt, DbChart, StrUtils,
    InfoMessage, Series;
  </code></pre>
  
  <p>IDE into IDE debugger breaks with the Out Of Memory Error at the below line:</p>
  
  <pre><code>KERNELBASE.GetLastError:
  75B445B0 64A118000000     mov eax, fs:[$00000018]
  75B445B6 8B4034           mov eax,[eax+$34]
  75B445B9 C3               ret 
  75B445BA CC               int 3
  75B445BB CC               int 3
  75B445BC CC               int 3
  75B445BD CC               int 3
  75B445BE CC               int 3
  75B445BF CC               int 3
  KERNELBASE.RaiseException:
  75B445C0 8BFF             mov edi,edi
  75B445C2 55               push ebp
  75B445C3 8BEC             mov ebp,esp
  75B445C5 83E4F8           and esp,-$08
  75B445C8 83EC58           sub esp,$58
  75B445CB A1345DBE75       mov eax,[$75be5d34]
  75B445D0 33C4             xor eax,esp
  75B445D2 89442454         mov [esp+$54],eax
  75B445D6 8B4508           mov eax,[ebp+$08]
  75B445D9 8B4D14           mov ecx,[ebp+$14]
  75B445DC 8364240800       and dword ptr [esp+$08],$00
  75B445E1 890424           mov [esp],eax
  75B445E4 8B450C           mov eax,[ebp+$0c]
  75B445E7 83E001           and eax,$01
  75B445EA C744240CC045B475 mov [esp+$0c],$75b445c0
  75B445F2 89442404         mov [esp+$04],eax
  75B445F6 85C9             test ecx,ecx
  75B445F8 7439             jz $75b44633
  75B445FA 8B4510           mov eax,[ebp+$10]
  75B445FD 83F80F           cmp eax,$0f
  75B44600 7738             jnbe $75b4463a
  75B44602 89442410         mov [esp+$10],eax
  75B44606 C1E002           shl eax,$02
  75B44609 50               push eax
  75B4460A 51               push ecx
  75B4460B 8D44241C         lea eax,[esp+$1c]
  75B4460F 50               push eax
  75B44610 E8AFC40100       call $75b60ac4
  75B44615 83C40C           add esp,$0c
  75B44618 8D0424           lea eax,[esp]
  75B4461B 50               push eax
  75B4461C FF159093BE75     call dword ptr [$75be9390]
  
  -&gt; 75B44622 8B4C2454         mov ecx,[esp+$54]
  
  75B44626 33CC             xor ecx,esp
  75B44628 E8A3EF0000       call $75b535d0
  75B4462D 8BE5             mov esp,ebp
  75B4462F 5D               pop ebp
  75B44630 C21000           ret $0010
  75B44633 8364241000       and dword ptr [esp+$10],$00
  75B44638 EBDE             jmp $75b44618
  75B4463A 6A0F             push $0f
  </code></pre>
  
  <p>My guess right now is that the problem started when I passed about 25 frames/charts, if there's some kind of limitation there. My problem is that I can't break down this form into smaller ones, as the charts I'm presenting only make sense when shown together (they are parts of a larger production flow). And I barely started, I was planning on having 35-40 graphs.</p>
  
  <p>Considering my project works OK at run-time, one solution would be to add the frames/charts at run-time, but that kinda defeats the purpose of using a RAD.</p>
  
  <p>Any help appreciated, thanks.</p>