VB6应用程序调用.NET的DLL内存不足异常 [英] VB6 App Calling .NET DLL OutOfMemory Exception

查看:305
本文介绍了VB6应用程序调用.NET的DLL内存不足异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个VB6应用程序调用了一个.NET的DLL。偶尔,VB6应用程序已经运行了很长一段时间后,并呼吁在.NET codeA很多,对事物的.NET方抛出内存溢出异常,即使有足够的可用内存的机器上。 VB6的内存空间,也没有在附近是极限。

We have a VB6 app that calls out to a .NET DLL. Occasionally, after the VB6 app has been running for a long time and has called the .NET code a lot, the .NET side of things throws an OutOfMemory exception, even though there is plenty of memory available on the machine. The VB6 memory space is also no where near it's limit.

请问.NET方保持独立的内存池?或者是它拆开了VB6应用程序的内存池?

Does the .NET side keep a separate memory pool? Or is it apart of the VB6 app's memory pool?

如果是独立的,有没有办法,看看它有多大?在我的任务管理器中的唯一巨大的内存项SQL Server和VB6应用程序(包括预期)。

If it is separate, is there a way to see how big it is? The only huge memory items in my Task Manager are SQL Server and the VB6 app (both expected).

这不会发生太频繁,但是当它,这是很难牵制为什么系统不会分配更多的内存。

This doesn't happen too often, but when it does, it's hard to pin down why the system won't allocate more memory.

推荐答案

答案最后被很简单的:

建有DEBUG配置的.NET的DLL会泄漏运行时。

A .NET DLL built with DEBUG configuration will leak while running.

切换到一个发布版本固定我的问题。

Switching to a RELEASE build fixed my issue.

背景:

我终于得到了蚂蚁调试VB6应用程序,请参见.NET程序(不得不改变VB6 code,以尽快加载.NET code)。有一次,我做到了,我看到了一个巨大的弱引用的对象,其父母是__ENCList的数量。这个类允许编辑和调试过程中继续。快速谷歌搜索,立即显示出这是通过使用调试版本引起的。

I finally got ANTS to debug the VB6 app and see the .NET process (had to change the VB6 code to load the .NET code as soon as possible). Once I did that, I saw a huge number of weak referenced objects whose parent was __ENCList. This classes allows for Edit and Continue during debugging. A quick Google search showed immediately this was caused by using a DEBUG build.

我的谷歌搜索

链接:

在WeakReferences在调试构建

这篇关于VB6应用程序调用.NET的DLL内存不足异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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