By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,538 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

DOM memory disposal question

P: n/a
Lee
Hi there,

Not sure if this is the most relevent newsgroup so please redirect me if
needed.

I just have a general query regarding how memory disposal works in relation
to the DOM object model. Take a look at the pseudo code below.

Dim odom as domdocument
dim onode as node
dim onodeclone as node
dim onodes as nodelist

odom = createobject

onode = selectsinglenode("/blah")
onodes = selectnodes("//blah")
onodeclone = onode.clone

Now, its a given that the odom object needs to be set to nothing but what
else does, if anything? My understanding is the following: -

The onode object will just hold a memory reference to somewhere in the odom
memory space.

onodes will store an array/arraylist of these memory references

onodeclone will have its own memory and contain a replica of the data stored
in the memory location referenced by onode.

So saying that, which of the above would I have to dispose of too? Are
onode and onodes taken care of when you dispose of the odom object? I am
guessing you would have to dispose of onodeclone since it has its own memory?

Maybe there is a web resource which explains this in detail?

Thanks in advance.
Jan 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Lee wrote:
Hi there,

Not sure if this is the most relevent newsgroup so please redirect me
if needed.

I just have a general query regarding how memory disposal works in
relation to the DOM object model.
You mean the XMLDOM model?
Take a look at the pseudo code
below. <snip> Now, its a given that the odom object needs to be set to nothing but


Not really. The garbage collector will do it for you. Oh, sure, if you have
a large domdocument, and your page has other processing to do, it could be
beneficial to release it early, but if your page is finished processing,
there is no need to do anything else.

Now if you were talking about an ADO Recordset, I would have a different
answer: there have been memory leaks reported as a consequence of failing to
close and destroy recordsets prior to closing and destroying the connections
used to open them. This does not apply to xml domdocuments

http://blogs.msdn.com/ericlippert/ar...28/122259.aspx

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jan 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.