TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Santhosh Kumar
NA
55
2.8k
Memory size increase in every navigation of jQuery ajax call
May 7 2018 12:48 AM
Initially the application size is 42 MB, but it is increased gradually from '0.5 to 1' MB for each navigation. After some-while the memory will not be released to its initial stage. It is retained in 68 MB (the GC is not released the memory).
- We have investigated with Google developer tool (F12 - Memory): the 'Detached DOM control' (of the previous navigation) are not released. Also there is no circular references (It is confirmed with two Snapshots).
- The recent changes are,
- We supported the 'Ajax call' instead of 'form submit' for the performance.
- We have replaced the 'BODY' content entirely by using the $('body').html(bodyContent); (we have used the initially loaded javascript & CSS, we just replace the body content).
- Our assumption is 'the jQuery internal cache, is not cleared the detached DOM elements'. So we have tried before the ajax call
- in Ajax call - options, we set 'false to cache'
- $.expr.cacheLength = 1 (As per -> http://stackoverflow.com/questions/17279143/jquery-sizzle-checkcontext-memory-leak)
- we force to delete all cache, like
for(var x in $.cache)
{
delete $.cache[x];
}
After the ajax call:
- set null to all global variables.
- before replacing the html(): force to delete all event listeners and 'register the events again' after the html() replacing.
- we also tried '$('body').empty() and $('body').detach()'
But we could not release detached DOM elements.
How do we release the Detached DOM elements? please suggest for this case.
Reply
Answers (
0
)
license plate recognition in asp.net c# can i get the code?
Can I convert ASP.NET web Application into a web API?