Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

JWPlayer memory leaking

Here's the simple page I'm testing:

<!DOCTYPE html>
<title>JWPlayer testing grounds</title>
<script type="text/javascript" src="../../libs/jquery.js"></script>
<script type="text/javascript" src="../../js/jw/jwplayer.js"></script>
<button onclick="init()">init</button>
<button onclick="cleanup()">cleanup</button>
<div id="content" class="">
<div id="video"></div>
<script type="text/javascript">
var cleanup = function() {
if ( window.jwplayer && window.jwplayer() && window.jwplayer().remove ) {
try {
} catch(e) {

var init = function() {
jwplayer.key="insert key here";
sources: [{
file: "", type:"mp4"
file: "", type:"webm"
width: "400px",

logo: {hide: true},
skin: "../../js/jw/six/six.css"


Now, if I analyze this with the chrome dev tools I can see an increase of nodes after following these steps: init, cleanup, garbage collect.

On cleanup I am calling the jwplayer().remove() function to cleanup the player but it's not clearing up everything as expected. Before initializing the player there are 32 nodes on the page and after cleanup and garbage collection we are still left with 201 nodes. So there's an extra 169 nodes being left after the player is deleted. Even if this is expected, repeating the process continually will keep adding 9 nodes at a time. This is on top of the 169 nodes that are left behind no matter what. To clarify these are the nodes shown in the dev tools when recording a memory timeline.

Is there some way we can prevent this memory leak in our cleanup of the player or is this something that needs to be changed inside the jwplayer itself?

2 Community Answers


JW Player Support Agent  
0 rated :

Thank you for providing this reproduction code. I will escalate this to our engineers and let you know what they come back with.


JW Player Support Agent  
0 rated :

Here’s the response I got from our product manager:

After calling remove there is still an instance of the player in memory, we do not delete from memory on remove. When you setup again we replace those nodes. We do not think this is cause for serious concern, we can look into it for a future release. Thanks for bringing it to our attention.

This question has received the maximum number of answers.