/    Sign up×
Community /Pin to ProfileBookmark

Memory Leak and Objects delete

I’m fairly experienced in JavaScript and been trying to do alot of new things with it in AJAX and such.

As my app got larger, JS part took 1000+ lines, it seems I have problem managing Objects. And the performance is starting to become sluggish after 10 minutes of constantly browsing through one page, since my AJAX app do not refresh the page a single time so there’s somekind of accumulation going on… I try to be careful but the inevitable happened ?

Is there a fast way to detect ALL of the Objects I’ve created?

Thanks!

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@davidckauthorMay 04.2006 — That's a great read. Thanks!

I found a way to loop through my objects using for (x in Object) in case anyone is interested. I will continue building my app as it is. Then use the suggested method of applying a 'null' to any unused objects.

The "leak" also happens in Firefox btw, so it's not just an IE thing. I use tools like "web developer" for firefox for zero error coding so I know I haven't made any coding error plus I use TRY CATCH on the entire prog. So it is leaking.

If there are any more ways to optimize this issue, let me know please ?
Copy linkTweet thisAlerts:
@davidckauthorMay 05.2006 — Thx, I saw that app before. I ran it for 10 min and it couldn't detect a single leak. Now I'm wondering if the problem lies somewhere else...
Copy linkTweet thisAlerts:
@davidckauthorMay 05.2006 — Drip is still useful, I can see how much memory is used after each request.

What I found out, it problably wasn't a leak afterall, but just an accumulation I thought the browser would take care of.

For those interested, besides the thousand lines of code, I use a package on the web (script.aculo.us) that allows some fancy effects in your AJAX application. When you do a SLIDEUP for example, your div will animate and disappear off your sight. However, the innerHTML attribute still lives thus whatever data you loaded in there is still in memory. And I kept loading data in constantly thus explaining the growing demand of ressource. Now I'm just starting to empty them up and I see significant improvement. Right now, my app loads in quite a bit of data. Although currently not an issue, I just foresee way later on when there will 10 times more data.

Thanks for suggesting Drip.
×

Success!

Help @davidck spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...