469,306 Members | 1,896 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

DOM memory disposal question

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
1 1426
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.

Similar topics

16 posts views Thread by Justin Lazanowski | last post: by
16 posts views Thread by Justin Lazanowski | last post: by
16 posts views Thread by Justin Lazanowski | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.