问题描述
大家好,
我在Visual Basic 6上遇到以下问题.
在默认的vb程序项目中,按钮事件处理程序中包含以下几行:
Hello Everyone,
I have the following issue on Visual Basic 6.
In a default vb program project, I have the following lines in a button event handler:
Private Sub Command1_Click()
On Error Resume Next
Dim Ws As Object
Dim CloneMeas As Object
Dim CloneSubMeas As Object
Dim lMeas As Long
Dim lSubMeas As Long
Set Ws = CreateObject("mm_office.workspace")
For lMeas = 1 To 8
Set CloneMeas = CreateObject("mm_office.measurement")
CloneMeas.Size = 1025
CloneMeas.Complex = True
For lSubMeas = 1 To 250
Set CloneSubMeas = CreateObject("mm_office.measurement")
CloneSubMeas.Size = 1025
CloneSubMeas.Complex = True
CloneMeas.measurements.Add CloneSubMeas
Set CloneSubMeas = Nothing
Next lSubMeas
Ws.measurements.Add CloneMeas
Set coSubMeass = Nothing
Set CloneMeas = Nothing
Next lMeas
MsgBox CStr(Ws.measurements.Count)
Ws.measurements.Removeall
MsgBox CStr(Ws.measurements.Count)
Set Ws = Nothing
End Sub
调用的对象在c ++ vs6中实现.
当我从vs6运行应用程序时,"Ws.measurements.Removeall"之后的内存返回到其初始状态.
如果我在编译版本中运行它,那么我将发生大约5 mb的内存泄漏.
可能是什么原因 ?我还没有看到内存泄漏,如果我运行一个示例c ++消费者应用程序,它可以正常工作.
真是疯了.
你已经看过类似的东西了吗?你可以给我什么样的建议?
提前非常感谢您.
最好的问候.
SuperMiQi.
The objects invoked are implemented in c++ vs6.
When I run the application from vs6, the memory after "Ws.measurements.Removeall" returns to his initial state.
If I run it in compiled version, I then get around 5 mb memory leakage.
What could be the reason ? I have not seen memory leakage and if I run a sample c++ consumer application, it works fine.
This is really crazy.
Do you have already seen something like that? What kind of advise could you post me ?
Thank you very much in advance.
Best regards.
SuperMiQi.
推荐答案
这篇关于内存未使用VB6释放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!