473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Memory leaks

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
3 1574
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Maurice | last post by:
Hi there, I'm experiencing big memory problems on my webserver. First on an old RedHat 7.2 system, now on an other fresh installed Suse 8.2 system: Linux version 2.4.20-4GB...
0
by: Steve Binney | last post by:
My code makes synchronous HttpWebRequest and HttpRebResponse calls. In VS 2003, I am getting memory leaks and event handle leaks. I am closing all streams and using "using"statements. I have...
2
by: Generic Usenet Account | last post by:
I have been using STL for a long time now, without any problems. Recently we generated a purification report on our software using Rational Purify, and we found some memory leaks. My colleague...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
16
by: graham.keellings | last post by:
hi, I'm looking for an open source memory pool. It's for use on an embedded system, if that makes any difference. Something with garbage collection/defragmentation would be nice. It should have...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.