Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to fix memory leak from third-party ads?

I'm getting a consistent memory leak on Playlist.com using Google DFP advertising - leaving the tab open, it consistently uses more and more memory (only when the ads are enabled).

A sample test page that reproduces the leak can be found here: http://dl.dropboxusercontent.com/u/6278910/ad-memory-leak.html.

Is there anything that can be done on our end to help mitigate the leak? Obviously shutting off the ads is not a possible solution, financially.

Edit: You can open developer tools in Chrome and try a memory timeline - every time the ads load, they use up slightly more memory.

like image 517
Jacob Gillespie Avatar asked Mar 12 '14 04:03

Jacob Gillespie


People also ask

Can a memory leak be fixed?

In most cases, you can fix the Windows 10 memory leak issues yourself. You can close resource-intensive apps, disable certain startup apps, and perform similar tasks to fix a memory leak.

How do you overcome memory leaks?

Use reference objects to avoid memory leaks ref package, you can work with the garbage collector in your program. This allows you to avoid directly referencing objects and use special reference objects that the garbage collector easily clears. The special subclasses allow you to refer to objects indirectly.

How do I fix an active process has a possible memory leak?

Memory leaks are when programs on the computer incorrectly manage memory allocations. This is not uncommon on modern software and can cause performance drags on the system. The easiest way to fix this issue is to close and reopen the program with the leak, as it will reset the allocations.

Can memory leak cause permanent damage?

Physical or permanent damage does not happen from memory leaks. Memory leaks are strictly a software issue, causing performance to slow down among applications within a given system. It should be noted a program taking up a lot of RAM space is not an indicator that memory is leaking.


1 Answers

This is possible, try to reload the iframe to clean the DOM before removing it, then add it again. See also this answer:

<a href="#">Remove</a>
<iframe src="url" />​

$('a').click(function(){
    $('iframe')[0].contentWindow.location.reload();
    setTimeout(function(){
       $('iframe').remove();
    }, 1000);

    ... add add iframe again ...
});​

Depending on how this is made there could some flickering of the adds, but it should not be major. The adds already refresh themselves after a while, so if this is done one add iframe at a time the user would not notice.

like image 50
Angular University Avatar answered Oct 10 '22 03:10

Angular University