I'm trying to clean up massive amounts of code. The biggest problem that I'm having is pinpointing the cause of memory leaks. I'm pretty sure that the main cause is objects that are not killed correctly (or at all). In the following :
I never use the line "rs.close". Is that a problem?
Can I say "set cn = nothing" if I don't close it (I've never tried that and I thought that it would throw an error).
If I don't explicitly close an object, will it be closed when I set it equal to nothing?
Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
Code:
set cn = server.createObject("adodb.connection")
cn.open application("connStr")
set rs = cn.execute("SELECT field1 FROM table1")
rs.close
set rs = nothing
cn.close
set cn = nothing
Can I say "set cn = nothing" if I don't close it (I've never tried that and I thought that it would throw an error).
If I don't explicitly close an object, will it be closed when I set it equal to nothing?
Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook