Hi Taco,

Dave is correct.  When you create a new structure, you are creating a container 
which is stored in memory.  You can assign as many pointers to it as you want 
during its lifetime.  

When you delete all the references to the container, said container is 
essentially "lost".  At that point I'm not sure what happens, but I imagine it 
gets scooped up by the garbage collector when the memory is needed by another 
container or a certain length of time passes, etc.

<!--- Create a new container in CF's memory --->
<cfset variables.stOriginalReference = structNew()>

<!--- Add a value to the container --->
<cfset variables.stOriginalReference.myKey = "myValue">

<!--- Create a second reference to the container --->
<cfset variables.stSecondReference = variables.stOriginalReference>

<!--- Delete the original reference (container still exists) --->
<cfset structDelete(variables, "stOriginalReference")>

<!--- Delete the second reference (container becomes "lost") --->
<cfset structDelete(variables, "stSecondReference")>

Hope this clears things up,

Matt

Matthew Drayer
Web Development Coordinator
HCPro, Inc.
Marblehead MA
[EMAIL PROTECTED]


>When I create a reference to a complex structure I was always under the
>impression that the reference would be destroyed if the original is
>destroyed, but it seems this is not the case. Can anyone confirm whether
>this is normal behaviour or not?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184736
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to