I see quite massive memory leaks on long-lasting pages using Chrome chrome.extension.sendMessage ()
After sending ~ 200k events from Content-Script to the background image as a test, the chrome.Event saved size is ~ 80% of the stored memory in the ~ 50 MB heap snapshot
I tried to track any errors that I could make by closing some kind of variable and not letting it be GC'd, but it seems to be related to the implementation of the Chrome event system
Has anyone come across anything like this or seen memory leaks with extremely long-lived extensions with Content-Scripts that often chat with the bg page?
Code on my Content- Script page:
csToBg = function(message) { var csToBgResponseHandler = function(response) { console.log("Got a response from bg"); }; var result = chrome.extension.sendMessage(null, message, csToBgResponseHandler) };
And on the Side-Page side, a simple ACK function (to superstitiously avoid https://code.google.com/p/chromium/issues/detail?id=114738 ):
var handleIncomingCSMessage = function(message, sender, sendResponse) { var response = message; response.acked = "ACK"; window.console.log("Got a message, ACKing to CS") sendResponse(response); }
After sending ~ 200k messages in Chrome 23.0.1271.97, this snapshot looks like: 
It seems that memory is never recovered for the life of the page, and I donβt understand how to fix it.
EDIT: This is a standard man page and not an event page.
google-chrome google-chrome-devtools google-chrome-extension
sgrove
source share