Re: References to windows.... PLUS! I want to sleep(), was Re: Is this a useful solution to fetching a window object by name?
- From: multicherry@xxxxxxxxx
- Date: 24 Aug 2006 03:24:06 -0700
Yanick wrote:
You were right about the potential problems in my code (what was I
thinking ?).
Not a problem; you pretty much said yourself that it was only a quick,
rough and untested idea, designed to illustrate a principle and nothing
more. So it wasn't my intention to hold it to the same standards as
(e.g.) the Linux kernel.... I was just proving I'd actually read it :-)
Memory leaks with Javascript are easier to produce than you might
think... Here's a link that gives some explanations :
http://www.codeproject.com/jscript/LeakPatterns.asp .
Haven't had time to consider everything in the article in depth, but it
appears that one of the examples is a circular reference being missed
because it straddles the territory of the DOM garbage collector and the
Javascript one. Interesting...
Playing with server side session IDs (with the help of
XMLHttpRequests...) you could synchronize all your "registered" windows
with a server side script... Or use a frameset with a single frame
(top) to load all you different pages and keep the Javascript
environment variables in the window scope (a messy solution...).
That's the one I was thinking of, and the way I would have done it in
the first place (or at least I'd have used frames), had I not been a
complete JS newbie when I designed the code and been unable to easily
change it later.
There's no straight foreward solutions, and the language is limited in
this situation (cookies cannot store objects), you will soon find that
memory leakage and broken references (or even cyclic ones) is more an
eventuality than possibility.
I have to say that I'm always asking myself how much my frustration
with JS is down to lack of experience and how much is down to
limitations with the language. In the case of JS, it's far more
advanced than it used to be, but I'm still aware that it's a simple
scripting language with stuff added on later... not to mention issues
of compatibility and incompatibility with different browsers and older
code.
Anyway, thanks to everyone for the feedback.
Bottom line, my window-grabbing "tip" still works (if you can live with
its hackiness), but the limitations described above mean its usefulness
isn't that great for most situations. :-/
- MCh
.
- References:
- Is this a useful solution to fetching a window object by name?
- From: multicherry
- Re: Is this a useful solution to fetching a window object by name?
- From: Yanick
- References to windows.... PLUS! I want to sleep(), was Re: Is this a useful solution to fetching a window object by name?
- From: multicherry
- Re: References to windows.... PLUS! I want to sleep(), was Re: Is this a useful solution to fetching a window object by name?
- From: Yanick
- Is this a useful solution to fetching a window object by name?
- Prev by Date: Re: How to send email to the addresses added in the text area of the form??
- Next by Date: Re: Set a DIV to be a footer: lowest coordinates in a page
- Previous by thread: Re: References to windows.... PLUS! I want to sleep(), was Re: Is this a useful solution to fetching a window object by name?
- Next by thread: How to get the physical memory status from the javascript?
- Index(es):
Relevant Pages
|
Loading