No error reported and memory leak if error occurs in Class_Terminate 
Author Message
 No error reported and memory leak if error occurs in Class_Terminate

We have just managed to remove a large (400K per page impression)
memory leak from an ASP website written in VBScript.

The scripting for the website makes extensive use of VBScript classes.

We have found that, should an error occur in the Class_Terminate sub
of one of the classes, no error is reported and a memory leak seems to
occur.

The following code extract was the culprit:

Private m_Ref
Private m_X

Private Sub Class_Terminate
    Set Ref = Nothing
End Sub

Public Property Set Ref(vValue)
    Set m_Ref = vValue
    Set m_Ref.X = m_X
End Property

X is a helper class, references to which are passed around to share a
single instance.

Clearly, "Set m_Ref.X = m_X" is in error when Ref is set to Nothing,
however, no error is reported by VBScript upon executing this line
within the Class_Terminate sub.

As mentioned, each page impression on this particular site led to the
DLLHOST.EXE process (the site was set to High isolation) adding 400K
to its VM size until the site application was unloaded, suggesting
that the script engine was not releasing resources.

Is this a known issue or something anybody else has encountered
working with VBScript classes?

Regards
Stuart Newton
idaho



Mon, 05 Dec 2005 01:45:24 GMT  
 No error reported and memory leak if error occurs in Class_Terminate


Quote:
> We have just managed to remove a large (400K per page impression)
> memory leak from an ASP website written in VBScript.

> The scripting for the website makes extensive use of VBScript classes.

> We have found that, should an error occur in the Class_Terminate sub
> of one of the classes, no error is reported and a memory leak seems to
> occur.

> The following code extract was the culprit:

> Private m_Ref
> Private m_X

> Private Sub Class_Terminate
>     Set Ref = Nothing
> End Sub

> Public Property Set Ref(vValue)
>     Set m_Ref = vValue
>     Set m_Ref.X = m_X
> End Property

Yup Yup, I've had those prob's before.  Also, try raising an error in a
Class_Terminate :)  It never stops when I do that heh ..

Mythran



Mon, 05 Dec 2005 07:51:23 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ADOCE / eVB Memory Leak - Fixed, but still Occurring

2. DLL stays in memory after error occurs in program

3. Possible memory leak - error '800a0007'

4. Memory Leak Report

5. Bug Report: JScript Memory Leak

6. On Error Resume Next problem and ADO memory leak

7. TransBlt Memory Leak or Coding Error?

8. CDB Error or CreateObject Memory leak

9. Error Handler - How to get line number where error occurred

10. Error Occurred in ASP Reports Server?

11. 1 * bxfcLDMXT-Odbc Error occurs while opening a CR 6.0 report in the Preview window

12. Odbc Error occurs while opening a CR 6.0 report in the Preview window

 

 
Powered by phpBB® Forum Software