cog
cog copied to clipboard
Memory leak in Cog when using local variables
Hello,
I have noticed a memory leak in Cog when a local variable is used inside a function called from a timer. Here is the code sample:
function SetDateTimeText() { //Get the current date let currentDate = new Date();
//Format the date/time string
let dateString = currentDate.toLocaleDateString('default', { weekday: 'long' }) + ", " +
currentDate.toLocaleDateString('default', { month: 'long' }) + " " +
currentDate.getDate().toString().padStart(2, '0') + ", " +
currentDate.getFullYear().toString() + " " +
currentDate.toLocaleTimeString();
//Set the date/time text
document.getElementById("DateText").innerHTML = dateString;
}
Function SetDateTimeText() is called from a timer function that is called every 250ms. Within a few minutes the Cog browser uses up all the available ram and Linux forces it close. Commenting out the line "let dateString=" removed the problem. The date/time will of course not update, but the memory leak will be gone. Can anyone please comment on this issue?
This looks like a WebKit bug, can you report to bugs.webkit.org please?