<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" type="text/css" href="content.css" />
		<title>
			Managing Flash Lite file memory for mobile devices
		</title>
<!-- Changed by: , 21-Mar-2006 -->
<script src="help.js" type="text/javascript" language="Javascript" charset="UTF-8">...</script> 
		
		
<script type="text/javascript">
<!--[CDATA[
handleContext(1);
if (use_ie_6_behavior) {
  document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"content-ie6.css\" />");
}
// ]]-->
</script> 
		
<script src="scripts.js" type="text/javascript" language="Javascript" charset="UTF-8">...</script> <script src="terms.js" type="text/javascript" language="Javascript" charset="UTF-8">...</script> 
	</head>
	<body id="content_body">
<!--googleoff: index-->
<!-- BEGIN PAGE CONTENT WRAPPER -->
		<div id="pneumonic">
			<h1 class="DeviceCentral">DeviceCentral</h1>
		</div>
		<div id="page_content_wrapper">
			<p class="sharedproducts">TOPIC APPEARS IN: </p><p class="sharedproductindicators"><img src="images/flashSharedIndicator.png" title="Flash" /></p>
<!-- BEGIN BREADCRUMBS -->
			<div id="breadcrumb">
<!-- BEGIN BREADCRUMBS -->
				
<div class="nav"><dl class="page"><dd class="prev"><a accesskey="p" class="prev" href="WSD7F8E1A9-680A-4000-9BA9-D7B01FDD7ECD.html" title="Optimizing ActionScript for Flash Lite content on mobile devices"><img src="images/prev.gif" alt="Previous" /></a></dd><dd class="next"><a accesskey="n" class="next" href="WS1459DECC-D858-475c-95CE-7E7D8C281AB2.html" title="Loading data for mobile devices in Flash Lite"><img src="images/next.gif" alt="Next" /></a></dd></dl></div><div class="hierarchy"><a href="WS28F6F81C-55B3-4ad5-B632-171637249F5B.html">Create, preview, and test content in Adobe Device Central</a> /
     <a href="WS3A29C98D-5768-45ea-AB2F-75FAF64078EE.html"><b>Tips for creating content for mobile devices</b></a> 
     </div>

<!-- END BREADCRUMBS -->
			</div>
<!-- END BREADCRUMBS -->
<!-- BEGIN PAGE TITLE -->
<!--googleon: index-->
			<h1>
				Managing Flash Lite file memory for mobile devices
			</h1>
<!--googleoff: index-->
<!-- END PAGE TITLE -->
<!-- BEGIN CONTENT WRAPPER -->
			<div id="content_wrapper">
<!--googleon: index-->
				<div><p>
                        
                        Flash Lite regularly clears from
memory any objects and variables that a file no longer references.
This is known as garbage collection. Flash Lite runs its garbage-collection
process once every 60 seconds, or whenever usage of file memory
increases suddenly by 20% or more.</p>
<p>Although you cannot control how and when Flash Lite performs
garbage collection, you can still free unneeded memory deliberately.
For timeline or global variables, use the <samp class="codeph">delete</samp> statement
to free the memory that ActionScript objects use. For local variables—for
example, a variable defined within a function definition—you can’t
use the <samp class="codeph">delete</samp> statement to free an object’s memory,
but you can set to <samp class="codeph">null</samp> the variable that references
the object. This frees the memory that the object uses, provided
there are no other references to that object.</p>
<p>The following two code examples show how to free memory that
objects use by deleting the variable that references those objects.
The examples are identical, except that the first example creates
a timeline variable and the second creates a global variable.</p>
<pre>// First case: variable attached to a movie or 
// movie clip timeline
//
// Create the Date object.
var mcDateObject = new Date();
// Returns the current date as a string.
trace(mcDateObject);
// Delete the object.
delete mcDateObject;
// Returns undefined.
trace(mcDateObject);
//
// Second case: global variable attached to a movie or 
// movie clip timeline 
//
// Create the Date object.
_global.gDateObject = new Date();
// Returns the current date as a string.
trace(_global.gDateObject);
// Delete the object.
delete _global.gDateObject;
// Returns undefined.
trace(_global.gDateObject);</pre>
<p>As mentioned previously, you can’t use the <samp class="codeph">delete</samp> statement
to free memory that a local function variable uses. Instead, set
the variable reference to <samp class="codeph">null</samp>, which has the same
effect as using <samp class="codeph">delete</samp>.</p>
<pre>function func()
{
	// Create the Date object.
	var funcDateObject = new Date();
	// Returns the current date as a string.
	trace(funcDateObject);
	// Delete has no effect.
	delete funcDateObject;
	// Still returns the current date.
	trace(funcDateObject);
	// Set the object reference to null.
	funcDateObject = null;
	// Returns null.
	trace(funcDateObject);
}
// Call func() function.
func();</pre>
</div>

<!--googleoff: index-->
			</div>
<!-- END CONTENT WRAPPER -->
		</div>
<!-- END PAGE CONTENT WRAPPER -->
		<br clear="both" />
		<div id="related">
			<div class="t">
				<div class="b">
					<div class="l">
						<div class="r">
							<div class="bl">
								<div class="br">
									<div class="tl">
										<div class="tr">
											<div id="related_in">
												<h3>
<script type="text/javascript">document.write(terms_Related_Information);</script> 
												</h3>
												
												<h4>
<script type="text/javascript">document.write(terms_AHV_HELP_RESOURCE_CENTER);</script> 
												</h4>
												<ul class="link-list"><li class="icon external"><a target="_blank" title="This page on the Web" href="http://help.adobe.com/en_US/DeviceCentral/1.0/WS4BC3BE1E-4574-4f96-BB90-23BFC3108D34.html">This page on the Web</a></li></ul>
												
											</div>
											<br clear="both" />
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<br clear="both" />
	</body>
</html>