VB6内存泄漏 [英] VB6 Memory Leak

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

问题描述

不包含关键字"New"的VB6程序会发生内存泄漏吗?

Can a VB6 program that does not contain the keyword 'New' have memory leaks?

如果是,请提供示例.

推荐答案

总结到目前为止的答案:调用另一个组件可能会导致内存泄漏.该组件可能有故障,或者您可能滥用了它.该组件可以是OCX或DLL(包括对Windows DLL的API调用,这是泄漏内存和Windows资源的好方法,更不用说许多其他令人兴奋的问题了.)

To summarise the answers so far: calling another component might introduce memory leaks. The component could be buggy, or you might be misusing it. The component could be an OCX or a DLL (including API calls into a Windows DLL, which is an excellent way to leak memory and windows resources not to mention lots of other thrilling problems).

还有一个要点:您可以使用CreateObject创建对象,这样就可以通过圆形引用,而无需使用New.并且 onedaywhen 在注释中指出,您还可以使用表单变量创建循环引用,而无需使用New.但是我认为问题的关键在于,除了循环引用之外,VB6内存泄漏是否还会有其他原因.

And a pedantic point: you can create objects using CreateObject, so you could leak memory through circular references without using New. And onedaywhen has pointed out in the comments you can also create circular references with form variables without using New. But I think the point of the question was whether VB6 memory leaks can have other causes besides circular references.

Recursive的答案不会导致内存泄漏-引用计数会整理每次执行循环时都需要记忆-请参阅我对答案的评论.

Recursive's answer does not cause a memory leak - reference counting will tidy up the memory on each execution of the loop - see my comment on the answer.

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

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