<html><head><style type='text/css'>body { font-family: 'Verdana'; font-size: 10pt; color: #000000}</style></head><body>Hi<br><br>We are on Flash 8 so that is OK.<br><br>What if I want to create the bitmap cache once and then use it several times? In detail the use case is as follows:<br><ul><li>we have several views showing essentially the same resource</li><li>we would like to create the bitmap cache the first time (the first view)</li><li>reuse that same bitmap cache in the 2nd and subsequent views</li></ul>Any chance? code samples?<br><br>Thanks<br>Gilad<br><br>Gilad&nbsp;Parann-Nissany<br><br>----- Original Message -----<br>From: "Max Carlson" &lt;max@openlaszlo.org&gt;<br>To: "Gilad Parann-Nissany" &lt;gilad.parann.nissany@g.ho.st&gt;<br>Cc: "P T Withington" &lt;ptw@laszlosystems.com&gt;, "Max Carlson" &lt;max@laszlosystems.com&gt;, "laszlo-user" &lt;laszlo-user@openlaszlo.org&gt;, "Ammar Tamazi" &lt;Ammar.Tazami@corp.G.ho.st&gt;, "Elias Khalil" &lt;Elias.Khalil@corp.G.ho.st&gt;, "Lou Iorio" &lt;liorio@laszlosystems.com&gt;<br>Sent: Monday, April 21, 2008 9:13:55 PM (GMT+0200) Auto-Detected<br>Subject: Re: Understanding Flash memory usage when using Laszlo<br><br>If you want to turn on bitmap caching via actionscript, you can see an <br>example in the drawview source:<br>http://svn.openlaszlo.org/openlaszlo/trunk/lps/components/extensions/drawview.lzx<br><br>e.g.:<br>var context = this.getMCRef();<br>context.cacheAsBitmap = true/false<br><br>This will work with any view, provided you're running flash 8 or greater.<br><br>If you find yourself doing this a lot, please file a bug and we can add <br>a more formal API to view for you. &nbsp;Note that the more actionscript you <br>add using this technique, the less your app will work in other runtimes...<br><br>All drawviews have cacheBitmap on by default. &nbsp;If you want to <br>experiment, you can try setting the drawview's cachebitmap attribute to <br>false.<br><br>Gilad Parann-Nissany wrote:<br>&gt; Thank you for the input. Could you give us concrete code examples of:<br>&gt; <br>&gt; 1. calling ActionScript directly in our OL code<br>&gt; <br>&gt; 2. using drawview (or any other technique) to create a bitmap cache of <br>&gt; our SWFs. Note: we can limit ourselves to "simple views' (views that do <br>&gt; not nest other views) as a first step if necessary.<br>&gt; <br>&gt; Gilad<br>&gt; <br>&gt; <br>&gt; <br>&gt; Gilad Parann-Nissany<br>&gt; <br>&gt; ----- Original Message -----<br>&gt; From: "Max Carlson" &lt;max@openlaszlo.org&gt;<br>&gt; To: "P T Withington" &lt;ptw@laszlosystems.com&gt;<br>&gt; Cc: "Gilad Parann-Nissany" &lt;gilad.parann.nissany@g.ho.st&gt;, "Max Carlson" <br>&gt; &lt;max@laszlosystems.com&gt;, "laszlo-user" &lt;laszlo-user@openlaszlo.org&gt;, <br>&gt; "Ammar Tamazi" &lt;Ammar.Tazami@corp.G.ho.st&gt;, "Elias Khalil" <br>&gt; &lt;Elias.Khalil@corp.G.ho.st&gt;, "Lou Iorio" &lt;liorio@laszlosystems.com&gt;<br>&gt; Sent: Thursday, April 17, 2008 7:18:24 PM (GMT+0200) Auto-Detected<br>&gt; Subject: Re: Understanding Flash memory usage when using Laszlo<br>&gt; <br>&gt; <br>&gt; <br>&gt; P T Withington wrote:<br>&gt; &nbsp;&gt; On 2008-04-17, at 09:12 EDT, Gilad Parann-Nissany wrote:<br>&gt; &nbsp;&gt;&gt; Hi<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; With the help from this forum we have been making progress<br>&gt; &nbsp;&gt;&gt; understanding our memory usage. See the separate thread: [Laszlo-user]<br>&gt; &nbsp;&gt;&gt; Understanding memory analysis when using _LzDebug.whyAlive()<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; We're now at the point were we see that the "smoots" taken up by<br>&gt; &nbsp;&gt;&gt; Laszlo objects are not all of our memory usage. It seems a large part<br>&gt; &nbsp;&gt;&gt; (large percentage of total RAM usage, maybe even more than 50%) may be<br>&gt; &nbsp;&gt;&gt; used elsewhere, perhaps in the Flash objects that are "underneath" the<br>&gt; &nbsp;&gt;&gt; Laszlo objects.<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; Questions:<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;1. Is there any tool or technique that allows us to analyze exactly<br>&gt; &nbsp;&gt;&gt; how this memory is being used by Flash? ("underneath" the laszlo<br>&gt; &nbsp;&gt;&gt; objects, I mean)<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; I am not aware of such a tool. &nbsp;There may be a tool provided by Adobe.<br>&gt; <br>&gt; Actually, this will be a nice benefit from the move to swf9. &nbsp;Flex<br>&gt; builder (and presumably fdb) have profiling tools that can show this<br>&gt; kind of memory usage.<br>&gt; <br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;2. Are there any guidelines to help us optimize this Flash part of<br>&gt; &nbsp;&gt;&gt; our memory usage?<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;3. More generally is there any way to use Flash-specific<br>&gt; &nbsp;&gt;&gt; optimization techniques (going to the ActionScript where necessary).<br>&gt; &nbsp;&gt;&gt; We know that in pure Flash there are several optimization techniques;<br>&gt; &nbsp;&gt;&gt; the following points are examples of things we wish to try<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;4. Can we in general call pieces of ActionScript from Laszlo script?<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; Yes. &nbsp;The OL compiler does not prevent you from doing that, but neither<br>&gt; &nbsp;&gt; is it supported.<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;5. Bitmap caching:<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;• SWF resources can be translated once into bitmaps (on the<br>&gt; &nbsp;&gt;&gt; client side) and cached<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;• you probably know this is known as bitmap caching.<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;• Then the bitmaps are used repeatedly instead of rendering the<br>&gt; &nbsp;&gt;&gt; SWF objects repeatedly.<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;• Can we do Bitmap Caching for all those vector graphics which<br>&gt; &nbsp;&gt;&gt; do not change frequently (from Laszlo, but possibly with specific<br>&gt; &nbsp;&gt;&gt; usage of Actionscript if necessary)<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; I believe Max (cc-ed) has experimented with this. &nbsp;There may even be<br>&gt; &nbsp;&gt; support in LZX for it.<br>&gt; <br>&gt; We do have support for this in drawview. &nbsp;We can experiment with adding<br>&gt; support for vector resources as well. &nbsp;There seemed to be side effects<br>&gt; for things with nested views, for example.<br>&gt; <br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;6.<br>&gt; &nbsp;&gt;&gt; Garbage collection: we would like to trigger the Flash garbage<br>&gt; &nbsp;&gt;&gt; collection just to test what is going on (as a test not permanent<br>&gt; &nbsp;&gt;&gt; change). Any way for us to do this?<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; I am not aware of a programmatic way of doing that. &nbsp;In most browsers,<br>&gt; &nbsp;&gt; if you minimize the window the app is running in the Flash GC will run.<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; Again, there are probably tools provided by Adobe for these purposes,<br>&gt; &nbsp;&gt; but I have not used them. &nbsp;There are probably more tools in the open<br>&gt; &nbsp;&gt; source Flex compiler, so the swf9 runtime should be easier to measure<br>&gt; &nbsp;&gt; and tune in this respect.<br>&gt; <br>&gt; -- <br>&gt; Regards,<br>&gt; Max Carlson<br>&gt; OpenLaszlo.org<br>&gt; <br><br>-- <br>Regards,<br>Max Carlson<br>OpenLaszlo.org<br></body></html>