> My coworker has a couple of times brought up the fact > that in some places I reset a variable without deleting > it. For example, if when looking at a user's session > variable, if I find it to be out of date I reset by > <CFSET session = StructNew()> > > Or if I just need to reset their basket contents I use: > StructInsert(session,"basket",ArrayNew(1)); > > Instead, he would use: > StructDelete(session,"basket"); > StructInsert(session,"basket",ArrayNew(1)); > > Is there any problems with the way I'm doing it? He is > concerned that it may leave some stuff out in memory.
CF, being a high-level language, has its own garbage collection, so you don't have to worry about this kind of stuff. It's just as good to overwrite a variable as it is to delete it and recreate it - even better, from a performance point of view. However, it's worth pointing out that in your first example, you have: <cfset session = StructNew()> You'll want to be careful with that. CF creates a few session variables, and can get confused if you delete them. I'd recommend just deleting the variables that you've created. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ______________________________________________________________________ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

