[Laszlo-dev] For Review: Change 20090217-bargull-Ada Summary: add repeat counter to addTimer and resetTimer

André Bargull andre.bargull at udo.edu
Tue Feb 17 11:58:34 PST 2009


Yep, using flash.util.Timer the CPU usage didn't increase, at least over 
10 minutes.

On 2/17/2009 8:35 PM, P T Withington wrote:
> Ok, sounds promising.  Thanks!
> 
> On 2009-02-17, at 14:11EST, André Bargull wrote:
> 
>> Calling clearTimeout helps to reduce the bad effects, but it's still 
>> not completely solved. So the CPU usage is still increasing over time, 
>> but it requires more time to reach 100% CPU usage (let's say no longer 
>> 1 minute, but 20-30 minutes, or so..). I'll try out the Timer class.
>>
>>
>> On 2/17/2009 7:47 PM, P T Withington wrote:
>>> Found in Adobe doc comment:
>>>> The following code demonstrates the behavior of the setTimeout 
>>>> function.
>>>>
>>>> If running this code with a Profiler and initiating the GC - the 
>>>> instances remain in the memory,
>>>> which does not happen if uncommenting the manually-added 
>>>> clearTimeout statement.
>>>>
>>>> This was found due to memory leaks which encountered by using 
>>>> setTimeout.
>>> [flash.utils Package - Adobe® Flex™ 2 Language 
>>> Reference](http://livedocs.adobe.com/flex/2/langref/flash/utils/package.html#setTimeout()) 
>>> So, perhaps there is a simple work-around we can make in the swf9 
>>> timer kernel?
>>> On 2009-02-17, at 12:46EST, André Bargull wrote:
>>>> This is a proposal how to fix LPP-7763 ("LzTimer hangs the system"). 
>>>> AFAIK, we need an API change to get around the flash player issue.
>>>>
>>>>
>>>> Change 20090217-bargull-Ada by bargull at dell--p4--2-53 on 2009-02-17 
>>>> 18:25:23
>>>> in /home/Admin/src/svn/openlaszlo/trunk
>>>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>>>
>>>> Summary: add repeat counter to addTimer and resetTimer
>>>>
>>>> New Features: LPP-7763
>>>>
>>>> Bugs Fixed:
>>>>
>>>> Technical Reviewer: ptw
>>>> QA Reviewer: (pending)
>>>> Doc Reviewer: (pending)
>>>>
>>>> Documentation:
>>>>
>>>> Release Notes:
>>>>
>>>> Details:
>>>> Add a new feature to lz.Timer#addTimer and resetTimer to accept the 
>>>> number of repetitions for the timer.
>>>> This helps to avoid an issue in swf9, where the flash player needed 
>>>> more and more cpu resources.
>>>> A call looks like:
>>>> lz.Timer.addTimer(delegate, 1000, 10) -> execute the given delegate 
>>>> 10 times in an interval of one second
>>>> Or: lz.Timer.addTimer(delegate, 1000, Infinity) -> execute the given 
>>>> delegate infinite times in an interval of one second
>>>>
>>>> The implementation relies on the fact that clearTimeout and 
>>>> clearInterval are interchangeable in all runtimes.
>>>>
>>>> Q: What should be the default value of "repeat": 0 or 1? Just asked 
>>>> because in lz.animatorgroup the "repeat" attribute describes that 
>>>> repeat = 1 means one execution, so that one repetition is equal to 
>>>> one execution, at least in OpenLaszlo-terms ;-) Should we be 
>>>> consistent to that implementation for the addTimer/resetTimer 
>>>> repeat-argument?
>>>>
>>>> Tests:
>>>>
>>>> Files:
>>>> M WEB-INF/lps/lfc/services/LzTimer.lzs
>>>>
>>>> Changeset: 
>>>> http://svn.openlaszlo.org/openlaszlo/patches/20090217-bargull-Ada.tar
>>>>
> 
> 


More information about the Laszlo-dev mailing list