Delphi内存不足 [英] Delphi out of memory

查看:193
本文介绍了Delphi内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

1天后启动程序时,出现内存不足错误

我该如何解决?

是否有任何代码可以清除内存?

我有一个主意,就是我每天早晨开始清除内存代码,这可能吗?

我尝试过的事情:

扫描代码并尝试查找泄漏部分

Hello,

when i start my program 1 day later i got out of memory error

how can i fix this?

does any code to clear the memory?

i have an idea which is i start memory clear code every morning,does this possible?

What I have tried:

scaning the code and try to find leak parts

推荐答案

避免内存泄漏是软件开发人员的主要职责之一.正如 Sergey 正确指出的那样,您的代码应正确处理内存分配/重新分配.
因此,正确的方法是修改代码以使其执行必要的释放.
Avoiding memory leaks is one of the main duties of the software developer. As correctly pointed out by Sergey, your code should correctly handle memory allocation/deallocation.
Hence the right approach here is revising the code in order to make it perform the necessary deallocations.


在Delphi中,防止内存泄漏非常容易,比大多数其他系统(没有垃圾的系统)要容易得多.集合,当然).有些产品可以为您完成所有检测,而无需您的任何帮助.只需一个电话即可激活它们.

我曾经使用过MemChk,它的工作原理十分完美: MemCheck主页 [ heaptrc [ ^ ],
泄漏视图 [ ^ ].

第二个链接显示高级用法;在大多数情况下,您不需要它.通常,您不需要这样的东西.

—SA
Preventing memory leaks in Delphi is extremely easy, much easier than with most other systems (those without garbage collection, of course). There are products which do all detection for you, without any of your help. It takes just one call to activate them.

I used to use MemChk, it worked flawlessly: MemCheck home page[^].

Presently I use Free Pascal, and highly recommend it, even if you use Delphi; Free Pascal is deeply cross-platform, with very interesting UI abstraction layer, which helps you to develop UI for very many platforms at the same time. It invokes similar memory leak finder automatically, just by checking one of the project options. Most likely, you can fetch its source code and use it for Deplhi as well. It''s called Heaptrc. It also works flawlessly. Please see:
heaptrc[^],
leakview[^].

The second link shows advanced usage; in most cases you need nothing of it. Usually, you don''t need anything like that.

—SA


这篇关于Delphi内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆