473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

memory leak in script??

Rea
Hey eb
can this be the reason for huge memory expansion ?
Doesn't this script free memory of the object it had created?

sub createCOMobject()
set obj1 = createObject("object1")
dim flag = 1
useObject flag,obj1
end sub
----------------------------------
sub useObject (flag, byRef obj1)
....
set obj1 = Nothing
end sub

Thanks for your attention
Rea

Aug 28 '06 #1
1 1568

"Rea" <Re*@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
Hey eb
can this be the reason for huge memory expansion ?
Doesn't this script free memory of the object it had created?

sub createCOMobject()
set obj1 = createObject("object1")
dim flag = 1
useObject flag,obj1
end sub
----------------------------------
sub useObject (flag, byRef obj1)
...
set obj1 = Nothing
end sub

Thanks for your attention
Rea
I've just posted this answer in the components group. Please don't
multipost.

Setting an object variable to nothing does not free memory.

Assigning a new value (whatever it is not just nothing) to variable will
cause the release method of the any currently held reference to be called
before the reference is replaced by the new value.

Calling release on an interface reference (commonly known as an object
variable) causes the object to decrement an internally held count of the
number of references that have been made. When this count reaches zero then
it is the object's responsibility to deallocate any memory or other
resources it may be holding.

obj1 is passed byRef (the default mode in VBScript BTW) so the assigning of
Nothing to obj1 is applied to the variable of the same name in the
createCOMobject procedure. Since this is the only reference being held the
internal reference count of the object drops to zero and the object should
destroy itself at this point.

However without the line assigning nothing to the obj1 variable the obj1
variable is destroyed when the procedure createCOMobject returns, at this
point any reference currently held in obj1 has it's release method called.
Hence in this case the assignment of nothing is superflous.

HTH,

Anthony.

Aug 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Guy | last post by:
Hi It might take me a little time to explain this but here goes. Firstly I'm not using the latest upto date python releases so my first plan is to try more upto date rels of python and win32...
2
by: Elbert Lev | last post by:
#When I'm running this script on my windows NT4.0 box, #every time dialog box is reopened there is memory growth 384K. #Bellow is the text I sent to Stephen Ferg (author of easygui) # I have...
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
10
by: Andrew Trevorrow | last post by:
No response to my last message, so I'll try a different tack... Does anyone know of, or even better, has anyone here written a C++ application for Mac/Windows that allows users to run Python...
14
by: Piotrek | last post by:
Hi all. I have a web app, in which I use frames. My main frameset consists of three inner frames. When some button is pressed in frame A, then content of frame B is reloaded. I am using such...
8
by: Lauren the Ravishing | last post by:
Hi, In ASP, is it absolutely necessary to set an object to Nothing after being used? set myObj = server.createObject("myDLL.myClass") call myObj.useClass set myObj = Nothing <--- can I...
0
by: nejucomo | last post by:
Hi folks, Quick Synopsis: A test script demonstrates a memory leak when I use pythonic extensions of my builtin types, but if I use the builtin types themselves there is no memory leak. ...
9
by: Bruno Barberi Gnecco | last post by:
I'm using PHP to run a CLI application. It's a script run by cron that parses some HTML files (with DOM XML), and I ended up using PHP to integrate with the rest of the code that already runs the...
2
by: Jay | last post by:
I have a web app running on the windows CE device. In one of the asp.net pages - it has javascript code. That seems to have a memory leak. When I run the web app - in about one hour, the app hangs....
11
by: dhtml | last post by:
(originally mis-posted on m.p.s.jscript...) I've just closed all windows in Firefox and its using 244MB of memory. I have no idea why. I had GMail open, a page from unicode, the CLJ FAQ. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.