memory leak in VB code 
Author Message
 memory leak in VB code

Hi, Experts,

Please help a VB newbie out.  

The user of our COM object (written in VB6.5) complains about the
object keeps handle open after each request (No CloseKey after OpenKey
and QueryValue).

before the end of function or sub, I always remember to set object or
referenced object to nothing, where does the leak come from? How can I
fix it?
Below is part of the code:
-----------------------------------------------------------------------------
Public Function gloWriteRead(inMsg As String, outMsg As String) As
Boolean
    On Error GoTo errorHandler

    Dim e As New imUtility
    Dim msg As String

    Dim HTTPserver As ServerXMLHTTP
    Dim url As String
    Dim connectBackup As Boolean

    Set HTTPserver = New ServerXMLHTTP
    ........

    gloWriteRead = False
    Set HTTPserver = Nothing
    Set e = Nothing
    Exit Function
  End If
 End If

......do something

gloWriteRead = True

    Set HTTPserver = Nothing
    Set e = Nothing
    Exit Function

errorHandler:

    If (Err.Number <> 0) Then

        ... do something

    Set HTTPserver = Nothing
    Set e = Nothing

End Function
----------------------------------------------------------------------------

Please help, thanks.

June



Sun, 08 May 2005 06:19:30 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Memory Leaks/Resource Leaks

2. TransBlt Memory Leak or Coding Error?

3. OLE Automation Problems - MEMORY HOG (Memory Leak?)

4. memory leak in vitual memory

5. memory leak on vitual memory

6. Memory Leak -- Out of Memory

7. ADO Memory Leak results in out of memory

8. Memory Leak in VB ACCESS 2k ?

9. memory leak on Outlook 2000 with VB

10. Memory leak in VB program that makes use of word

11. Interop memory leak with VB.NET to VC++

12. Memory leak! (ADO.NET, VB.NET)

 

 
Powered by phpBB® Forum Software