views:

50

answers:

0

Hey all, I have a chrome extension thats very complex, but I'll simplify the issue which can be reproduced easily.

manifest.json:

{
  "name": "script",
  "version": "1.0",
  "description": "script",
  "browser_action": {
    "default_icon": "icon.jpg"
  },
  "permissions": [
    "tabs", 
    "http://www.google.com/"
  ],
  "background_page" : "background.html",
  "content_scripts":[
  {
"matches":["http://www.google.com/"],
"js":["/jquery.js","/script.js"]
}

] }

script.js:

var item = null;
restart();
function restart() {
    item = null;
    item = new Object();
    item.Go = Go;
    item.Go();
}

function Go() {
    setTimeout(function () { restart(); }, 5);
}

background.html:does nothing for now

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="http://code.jquery.com/jquery-1.4.2.min.js" language="javascript" type="text/javascript"></script>
</head>
<body>
</body>
</html>

Now, when what my project is supposed to do is very simple...refresh a page, scrape data, post the results to a local jsonp web service, repeat. I'm having an issue with the chrome tab and the extension hogging memory, which can be viewed by pressing SHIFT+ESC in chrome. Run the above extension for chrome and you can slowly see the page size constantly increase in size. With the example above you can see that the tab increases but the extension memory usage does not increase until things get a bit more difficult.

Why does the memory usage increase constantly when the only thing going on is an item being created then nullified over and over again? Shouldn't that clear the object from memory?