我正在 Delphi Rio 10.3 社区开发一个项目,目前有 24 个单元。我遇到问题的这个特殊表单包含 28 个相同类型的帧,每个帧都包含一个带有几个按钮和复选框的 TChart 组件(打印图表、显示/隐藏系列/标签等)。一切都很好,直到大约 20-25 帧/图表,但昨天我又添加了几个,直到达到 28。在设计和运行时没有任何错误,所以我在一天结束时愉快地关闭了 Delphi。
下次我启动Delphi时问题开始了。当我打开我的项目时,我得到的确切错误是“创建表单时出错:内存不足”。确认错误后,项目仍然可以正常打开,除了这个具有 28 帧/图表的特定 DFM 文件。我仍然可以毫无问题地编译和运行该项目,但我无法在 IDE 中可视化表单以进一步开发它。
我知道我达到了某种限制,尽管项目/表格并不大。我有一个 32GB 内存的 i7,Windows 显示我有 26GB 可用,所以我认为这已经足够了。
我没有在网上找到任何对这个确切错误消息的引用,但有一些类似的编译器错误,这不是我的情况:
http://docwiki.embarcadero.com/RADStudio/Rio/en/F2046_Out_of_memory_(德尔福)
但是,我确实尝试了在 Windows 中增加交换文件大小的解决方法,但没有运气。
我还从 Andy 安装了最新的 IDE Fix Pack 6.4.2,同样没有成功:
https://andy.jgknet.de/blog/ide-tools/ide-fix-pack/
DFM 文件大约有 3000 行,因此只粘贴其中的 28 个帧/图表之一:
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
单元标题:
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;
IDE 到 IDE 调试器会在以下行出现内存不足错误:
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]
-> 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
我现在的猜测是,当我通过大约 25 帧/图表时,问题就开始了,如果那里有某种限制的话。我的问题是我不能把这个表格分解成更小的表格,因为我展示的图表只有在一起显示时才有意义(它们是更大生产流程的一部分)。我几乎没有开始,我打算有 35-40 个图表。
考虑到我的项目在运行时运行良好,一种解决方案是在运行时添加框架/图表,但这有点违背了使用 RAD 的目的。
任何帮助表示赞赏,谢谢。