CF Quick Tip: Destroying Variables

You can effectively destroy a variable by setting it to an empty string such as...

<cfset arrMyBooks = "" /> <!--- Set the array of Books to an empty string --->

So why would you want to do this? You do it to free up memory when a variable/object is no longer needed, but you still have a bit of processing left to do on your page. Why? Because it is better to pro-actively release resources when not needed, than to not do so and run the risk of pushing memory usage past 90% of the allocated heap. And as you may know, when you push past that 90% memory utilization is where you start to see issues, especially if the JVM garbage collector is not keeping up.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.