Opened 10 years ago

Closed 10 years ago

#15850 closed defect (worksforme)

Memory Leak When Updating Graph

Reported by: jlkABB Owned by: Eugene Lazutkin
Priority: undecided Milestone: tbd
Component: Charting Version: 1.8.0
Keywords: Cc: cjolif, Patrick Ruzand
Blocked By: Blocking:


When continuously updating a graph the memory footprint continues to grow until it consumes all available memory.

A barebones example:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Graph Example</title>
<script type="text/javascript" src="./js/dojo/dojo/dojo.js"></script>

<script type="text/javascript">
var dojoGraphObject = null;
var on = true;
var handle = null;

 * Convert an array of single values into an object with x,y plus tooltip for use in the dojo graph 
function dojoCountData(inArray){
	var tempArray = new Array();
	for(i in inArray) tempArray.push({x:i,y:inArray[i]});	
	return tempArray;

function setupGraph(id){

	dojoGraphObject = new dojox.charting.Chart2D(id);
	dojoGraphObject.addPlot("default", {
	    //type of chart
	    type: "Lines",
	    //show markers at number points?
	    markers: true,
	    //show lines?
	    lines: true,
	    //fill in areas?
	    areas: false,
	    //offset position for label
	    labelOffset: -40,
	    //add shadows to lines
	    shadows: { dx:2, dy:2, dw:2 }

	//add a plot area for datapoints to exist in
	this.dojoGraphObject.addPlot("Grid", {type: "Grid",

	    hMajorLines: true,
	    hMinorLines: false,
	    vMajorLines: true,
	    vMinorLines: false

function addAxis(){
	dojoGraphObject.addAxis("x",{min: 0, max: 100});
	dojoGraphObject.addAxis("y", {vertical:true, min: 0, max: 100});

function randomValues(){
	var tempArray = new Array();
	for(var i =0;i<100;i++) tempArray.push(Math.floor(Math.random()*101));
	return tempArray;

function load(){
	handle = setInterval(addPoints,250);	

function addPoints(){

function runToggle(button){

	on = !on;
	if(on){ button.value = "Turn Off"; addPoints(); handle = setInterval(addPoints,250);}
	else{ button.value = "Turn On"; clearInterval(handle);}


<body onload="load();">

<div id="divDojoGraph" style="float:left;width:100%"></div>
<br/><input type="button" id="btnAdd" value="Radomize Points" onclick="addPoints();" />
<br/><input type="button" id="btnToggle" value="Turn Off" onclick="runToggle(this);" />


Change History (4)

comment:1 Changed 10 years ago by ben hockey

Cc: cjolif Patrick Ruzand added

this sounds like its related to the most recent comments on #14589. could you try the latest patch on that ticket ( and see if it helps? that patch fixes a very significant memory leak that was discovered moments before 1.8 was tagged. if you can confirm that the patch fixes your problems we can work towards having that patch incorporated as quickly as possible.

comment:2 Changed 10 years ago by cjolif

Personally if I'm running the provided sample on Firefox 10 ESR on Windows 7, with Dojo 1.8 (final) and without the patch I don't notice a memory increase after 1 hour (looking at Task Manager). Are you running a different browser version, Dojo version (some other memory leaks were fixed between 1.7.2 and 1.8 for example) or OS version? How long do you wait?

comment:3 Changed 10 years ago by jlkABB

Thank you both for the heads up. I was using 1.7.2 but now having swapped to 1.8 there is no longer an issue. Again, I thank you very much!

comment:4 Changed 10 years ago by cjolif

Resolution: worksforme
Status: newclosed

This one was actually not reproducible anymore. That said #14589 is still open as some (other) leaks still exist.

Note: See TracTickets for help on using tickets.