Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Releasing Object Reference?
I want to know if you have to explicitly Set an object Reference to Nothing or will there be a memory leak? Please see example. I basically want to know if I should be setting the oDomDoc = Nothing?
Thanks.
Public Function GetDomDocByFile(strXmlSource As String, _
strLanguageCode As String, _
Optional blnLoadAsync As Boolean = False, _
Optional blnPreserveWhiteSpace As Boolean = False, _
Optional blnResolveExternals As Boolean = False, _
Optional blnValidateOnParse As Boolean = False) _
As MSXML.IXMLDOMNode
Dim oDomDoc As MSXML.DOMDocument
Set oDomDoc = New MSXML.DOMDocument
oDomDoc.async = blnLoadAsync
oDomDoc.preserveWhiteSpace = blnPreserveWhiteSpace
oDomDoc.resolveExternals = blnResolveExternals
oDomDoc.validateOnParse = blnValidateOnParse
oDomDoc.Load strXmlSource
'Convert resources to different language if needed.
modDasUIL.ConvertLanguage oDomDoc, strLanguageCode
Set GetDomDocByFile = oDomDoc.documentElement
Set oDomDoc = Nothing
End Function
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement