By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,600 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,600 IT Pros & Developers. It's quick & easy.

Memory leaks

P: n/a
Hi All. I'm building t a User Interface, which populates tables from
a database dynamically. It's using a technology called CACHE
(pronounced cashai, made by intersystemís) to get the data form the
server. There is no page loading or refreshing. It's very much like
Ajax except there is no external file called, the server interprets
these calls right there on the page and returns the value, just like
calling a function. Interesting stuff.

Anyway, the data I get back is a huge JSON object, which sits in
memory; this doesnít seem to pose a problem. I've got Windows Task
Manager open and I watch the little line graph move up and down.

I iterate through the JSON object to populate a table. There are only
about 1000 rows so itís not many, but I am building the table
pragmatically using the DOM.

The first time I run this code it shoots through very quickly. Even
if a I press the button which causes it to run through the process
again, it still runs quickly. And even if I press it continuously, it
runs the same speed. But if I refresh the page by right clicking and
'refresh page' or 'F5' the code runs but slower. And every subsequent
page refresh and code run the code gets slower and slower. The CPU
usage line graph starts hitting the roof.

I would have thought that the page refresh would clear memory?
I'm trying to clear up after myself by setting certain variable to
null, but no change. If I close the browser down and start again, the
code runs quick again.

Why does the code run the same speed until I refresh the page. Are
new variables being instantiated each time I load the page and the old
ones staying alive?

Cheers All.
Graham
Jul 31 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Laser Lips wrote:
Hi All. *I'm building t a User Interface, which populates tables from
a database dynamically. *It's using a technology called CACHE
(pronounced cashai, made by intersystemís) to get the data form the
server. *There is no page loading or refreshing. *It's very much like
Ajax except there is no external file called, the server interprets
these calls right there on the page and returns the value, just like
calling a function. *Interesting stuff.

Anyway, the data I get back is a huge JSON object, which sits in
memory; this doesnít seem to pose a problem. *I've got Windows Task
Manager open and I watch the little line graph move up and down.

I iterate through the JSON object to populate a table. *There are only
about 1000 rows so itís not many, but I am building the table
pragmatically using the DOM.

The first time I run this code it shoots through very quickly. *Even
if a I press the button which causes it to run through the process
again, it still runs quickly. *And even if I press it continuously, it
runs the same speed. But if I refresh the page by right clicking and
'refresh page' or 'F5' the code runs but slower. *And every subsequent
page refresh and code run the code gets slower and slower. The CPU
usage line graph starts hitting the roof.

I would have thought that the page refresh would clear memory?
I'm trying to clear up after myself by setting certain variable to
null, but no change. *If I close the browser down and start again, the
code runs quick again.

Why does the code run the same speed until I refresh the page. *Are
new variables being instantiated each time I load the page and the old
ones staying alive?
I think your observations are normal. F5 does refresh the page but not
the cache (use CTRL+F5 for that).

You claim that the huge JSON-object (which represents 1000 table rows)
is not that heavy; I tend to think differently about such amounts of
data on one web page. Once you want a solid program I think it's
unwise to invoke this kind of memory requirements. You cannot be sure
about the available memory of the client anyhow.

--
Bart
Jul 31 '08 #2

P: n/a
On Jul 31, 4:56 pm, Bart Van der Donck <b...@nijlen.comwrote:
Laser Lips wrote:
Hi All. I'm building t a User Interface, which populates tables from
a database dynamically. It's using a technology called CACHE
(pronounced cashai, made by intersystemís) to get the data form the
server. There is no page loading or refreshing. It's very much like
Ajax except there is no external file called, the server interprets
these calls right there on the page and returns the value, just like
calling a function. Interesting stuff.
Anyway, the data I get back is a huge JSON object, which sits in
memory; this doesnít seem to pose a problem. I've got Windows Task
Manager open and I watch the little line graph move up and down.
I iterate through the JSON object to populate a table. There are only
about 1000 rows so itís not many, but I am building the table
pragmatically using the DOM.
The first time I run this code it shoots through very quickly. Even
if a I press the button which causes it to run through the process
again, it still runs quickly. And even if I press it continuously, it
runs the same speed. But if I refresh the page by right clicking and
'refresh page' or 'F5' the code runs but slower. And every subsequent
page refresh and code run the code gets slower and slower. The CPU
usage line graph starts hitting the roof.
I would have thought that the page refresh would clear memory?
I'm trying to clear up after myself by setting certain variable to
null, but no change. If I close the browser down and start again, the
code runs quick again.
Why does the code run the same speed until I refresh the page. Are
new variables being instantiated each time I load the page and the old
ones staying alive?

I think your observations are normal. F5 does refresh the page but not
the cache (use CTRL+F5 for that).

You claim that the huge JSON-object (which represents 1000 table rows)
is not that heavy; I tend to think differently about such amounts of
data on one web page. Once you want a solid program I think it's
unwise to invoke this kind of memory requirements. You cannot be sure
about the available memory of the client anyhow.

--
Bart
Bart, your concern is correct, but how can I see how much memory is
being used by the JSON object. I dont think windows memory graph is
good enough.

I'll look around for some aps
Aug 1 '08 #3

P: n/a
Laser Lips wrote:
...
Bart, your concern is correct, but how can I see how much memory is
being used by the JSON object. *I dont think windows memory graph is
good enough.
I don't have a real need for such extra tools, but that might be my
personal opinion. Common sense is probably more important; especially
when coding for unknown computers (which is the default execution
environment of javascript). And better play safe in case of doubt.

Car brands invest billions of Euros in Formula-One; not because
they're Ipso Facto sports fans, but because exploring the limits of
their technologies gives them a vast benefit for the daily production
work.

Cheers

--
Bart
Aug 2 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.