Depends on how you define "kill" data. If you look at this:

<cfset a = StructNew()>
<cfset a.c = 123>
<cfset b = a>

This proves a and b are identical. It does not necessarily prove
aliasing.
<cfdump var="#a#">
<cfdump var="#b#">

<cfset b.d = 456>

This proves a and b are identical and in fact are pointing to the same
object/structure.
<cfdump var="#a#">
<cfdump var="#b#">

This assigns a to point a new object/structure.
<cfset a = StructNew()>

This proves that the structure that a was originally assigned to a was
not destroyed.
<cfdump var="#a#">
<cfdump var="#b#">


Memory deallocation, from my experience, happens at the end of a
request. It makes sense that way, and that would be how I would
implement the CFML interpreter engine anyway since all the engine needs
to do is to keep track of the heap memory assigned to the thread
performing the CFM request, and just return the heaps back to the heap
pool when the request ends. I think Allaire/MACR used to call them
SmartHeaps. Pretty funny name. ;)

----------------------------
James Ang
Programmer
MedSeek, Inc.
[EMAIL PROTECTED]




-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, September 18, 2002 9:16 AM
To: CF-Talk
Subject: RE: does StructNew() destroy old structure completely?


It doesn't harm anything at all. I guess you could say you don't need
structClear(), but it's a matter of personal preference. If my intent
was to clear the struct, I'd use it just because it makes more sense to
me when I read the code.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Hire

Email    : [EMAIL PROTECTED]
Yahoo IM : cfjedimaster

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Tony Weeg [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, September 18, 2002 12:07 PM
> To: CF-Talk
> Subject: RE: does StructNew() destroy old structure completely?
> 
> 
> so, like his question, does that muck
> things up at all? memory wise? just wondering.
> 
> also, does it spell out the lack of need for structClear()
> 
> ..tony
> 
> Tony Weeg
> Senior Web Developer
> Information System Design
> Navtrak, Inc.
> Fleet Management Solutions
> www.navtrak.net
> 410.548.2337 
> 
> 
> -----Original Message-----
> From: Raymond Camden [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, September 18, 2002 10:36 AM
> To: CF-Talk
> Subject: RE: does StructNew() destroy old structure completely?
> 
> 
> structNew will kill the old data.
> 
> ==============================================================
> =========
> Raymond Camden, ColdFusion Jedi Master for Hire
> 
> Email    : [EMAIL PROTECTED]
> Yahoo IM : cfjedimaster
> 
> "My ally is the Force, and a powerful ally it is." - Yoda 
> 
> > -----Original Message-----
> > From: Gyrus [mailto:[EMAIL PROTECTED]] 
> > Sent: Wednesday, September 18, 2002 9:50 AM
> > To: CF-Talk
> > Subject: does StructNew() destroy old structure completely?
> > 
> > 
> > I've got a structure in the Application scope that I use to 
> > store different
> > types of information, depending on circumstances.
> > 
> > When the structure's contents need replacing, I just initiate 
> > the process
> > with
> > 
> > <cfset myStruct = StructNew()>
> > 
> > My question is: if 'myStruct' already contains a set of 
> > key-value pairs,
> > will StructNew() clear it completely, allowing for totally 
> > new key-value
> > pairs? Or could there be problems along the way?
> > 
> > My tests seem to indicate the former, but I keep wondering whether
> > StructClear() is necessary here or not.
> > 
> > - Gyrus
> > 
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > - [EMAIL PROTECTED]
> > work: http://www.tengai.co.uk
> > play: http://www.norlonto.net
> > - PGP key available
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > 
> 
> 

______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
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

Reply via email to