阅读:1574回复:0
SuperWorkSpace打开存放在oracle中的工作空间时引入的内存泄露问题
最近使用SuperMap开发一个访问存放在Oracle中的工作空间的小例子时碰到了明显的内存泄漏问题。<br>程序的功能就是点击“打开”按钮时,打开工作空间,并打开该工作空间下的一个地图。<br>点击“关闭”按钮时,关闭地图,断开与WorkSpace的链接,并关闭工作空间。<br>碰到的问题就是当我循环的点击打开和关闭按钮时,通过任务管理器发现程序运行占用的内存明显的在不断增加。具体的说就是每次调用SuperWorkspace1.Open方法时内存增大,但调用.SuperWorkspace1.Close方法时,内存并不减少。由此,我推断是出现了内存泄露问题,但是我自己有找不出代码上有什么不合理的地方,所以想请大家帮我看看,看能不能找出问题的原因,谢谢大家了<br>代码如下:<br>Private Sub OpenWorkSpace()<br > Dim strPassword As String<br > Dim strFilePath As String<br > Dim strDSStation As String<br > strDSStation = "station01"<br > strPassword = "uid=" ; strDSStation ; ";pwd=" ; strDSStation<br > strFilePath = "Provider = MSDAORA;Driver= Oracle in Orahome92 ;SERVER =gispipe;Database = " ; strDSStation ; ";Caption = " ; strDSStation<br > bResult = Me.SuperWorkspace1.Open(strFilePath, strPassword)<br > If Not bResult Then<br > MsgBox "打开数据失败", vbCritical, "提示"<br > Else<br > Me.SuperMap1.Connect Me.SuperWorkspace1.Handle<br > Me.SuperMap1.OpenMap "stationback"<br > Me.SuperMap1.Action = scaPan<br > Me.SuperMap1.Refresh<br > End If<br >End Sub<br ><br >Private Sub Command1_Click()<br > OpenWorkSpace<br >End Sub<br ><br >Private Sub Command2_Click()<br > CloseWorkSpace<br >End Sub<br ><br >Private Sub Form_Unload(Cancel As Integer)<br > Me.SuperMap1.Close<br > Me.SuperMap1.Disconnect<br > Me.SuperWorkspace1.Close<br >End Sub<br ><br >Private Sub CloseWorkSpace()<br > Me.SuperMap1.Close<br > Me.SuperMap1.Disconnect<br > Me.SuperWorkspace1.Close<br > Me.SuperMap1.Refresh<br >End Sub<br><br><br><br><br><img src="images/post/smile/dvbbs/em12.gif" />
|
|