Archive for the ‘Javascript’ Category

setTimeout memory leak

Sunday, March 20th, 2011

For those who use setTimeout function in Javascript - do not pass name of function you want to trigger as a sting. If used with string - Javascript will use EVAL to execute it - this is creating a memory leak if used for instant loop. Garbadge collector will not clear the memory after calling clearTimeout and delete setTimeout object. Insted of using string - use blank funtion and put funtion you want to trigger inside. This will not involve EVAL, but will generate a pointer that Garbadge collector will handle and free up memory.


// generates memory leak:
myTimeout = setTimeout(”myFunction()”, 1000);
// no memory leak (no parameters to pass):
myTimeout = setTimeout(myFunction, 1000);
// OR:
myTimeout = setTimeout(function() { myFunction(); }, 1000);

Unfortunately, all the the samples of setTimeout function out there in the internet are passing string as parameter. Hard to identify memory leak, but it is there.

Lytebox 3.20 Modification

Sunday, September 9th, 2007

This page is a brief demonstration of additional functionalify of Lytebox by Markus F. Hay. I took version 3.20 as a base and have added things I want too see there. Take a look by clicking on links below:

Click to Close
Next features Demo
Test them on Slideshow
Single Slideshow
Google in Lyteframe
Yahoo in Lyteframe

New features:
- Show Hints
- Click to Close
- Easy Save
- Show Additional Infomation page
- Show image EXIF information
- Button to resize big images
- Save button (disabled in this demo)
- All text strings are in config area (easy localization)
- Frame tweeks
- and other minor code tweeks (you can now compress JS file with no further execution errors)

Download: lytebox_mod.zip

Sincerely,
Pavel Kuzub

Thanks for Jim Bertucci, for his initiative and his photos used in this demo.