I seem to be getting a memory leak on the grid widget. I pasted my code is below. In Firefox 12, when the application first runs up, Windows Task Manager says it is taking up around 60Mb of memory. If you click the add button, the memory used grows to around 85Mb, When you click the remove button, the memory does reduce a bit (after about 30 secs), but it only reduces to around 80Mb.
Is there leak in my code or kendo grid widget?
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<script src="Scripts/jquery.min.js"></script>
<script src="Scripts/kendo.web.min.js"></script>
<link href="Styles/kendo.common.min.css" rel="stylesheet" />
<link href="Styles/kendo.metro.min.css" rel="stylesheet" />
</head>
<body>
<div>
<button id="add" value="add">add</button>
<button id="remove" value="remove">remove</button>
<div id="grid"></div>
</div>
<script>
$(document).ready(function () {
$("#add").click(function () {
var data = [],
sharableDataSource,
i;
for (i = 0; i < 5000; i = i + 1) {
data.push({ field: "value " + i
});
}
sharableDataSource = new kendo.data.DataSource({ data: data });
$("#grid").kendoGrid({
groupable: false,
scrollable: true,
sortable: true,
pageable: false,
resizable: true,
selectable: "row",
dataSource: sharableDataSource,
columns: [{ field: "field", title: "field" }]
}).data("kendoGrid");
data = null;
sharableDataSource = null;
});
$("#remove").click(function () {
$("#grid").empty();
});
});
</script>
</body>
</html>