On Jun 12, 3:16 pm, "Jean-Philippe Encausse" <[EMAIL PROTECTED]>
wrote:
> Thanks,
>
> The leak append when an object of the JS world store an object of the
> DOM world in IE 6 only. Because of GC problems.
Problems with IE memory leaks (which probably should be called JScript
memory leaks, not javascript leaks) can be fixed by removing handlers
involving cicular references with DOM and window objects in intrinsic
event handlers.
<URL: http://www.jibbering.com/faq/faq_notes/closures.html#clMem >
> http://www.codeproject.com/jscript/leakpatterns.asp
>
> About your code I would do
>
> $$("ul#menu li").each(function(element,idx) { element.myId =
> Math.random()+idx; });
>
> I would add "idx" because Math.random() is based on current system
> time. On fast computer you will have the same result because opertaion
> are done at the same millisec.
I seriously doubt that - there is nothing in the ECMAScript
specification that says how Math.random works. Most modern computers
can calculate quite a few random numbers per millisecond - a 2GHz
Core2Duo does between 10 and 50 in Firefox, up to 170 in Safari. A
simple test shows no duplicates in all the numbers generated in a
single millisecond. Do you have any references indicating a problem?
The ECMAScript spec says:
"15.8.2.14 random ( )
"Returns a number value with positive sign, greater than or
equal to 0 but lessthan 1, chosen randomly or pseudo
randomly with approximately uniform distribution over that
range, using an implementation-dependent algorithm or
strategy. This function takes no arguments."
I don't see anywhere there that says "must use the system clock to
seed the algorithm".
--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---