Native Messaging / Message Passing: Memory Leak (GC roots) / (Global handles)
Reported by
dmnkho...@gmail.com,
Jul 21 2017
|
||||||
Issue descriptionChrome Version : 59.0.3071.115 OS Version: 10.0 URLs (if applicable) : - Other browsers tested: Firefox 52 64 Bit (The problem does not occur here) What steps will reproduce the problem? 1. Create a chrome extension with native messaging and message passing from content script to background script and native messaging host - content script: window.addEventListener / chrome.runtime.connect / chrome.runtime.postMessage - background script: chrome.runtime.onConnect.addListener / Port.onMessage.addListener / chrome.runtime.connectNative / Port.postMessage 2. Send a big amount of JSON objects (e.g. some hundred) with big strings contained (about 1 MB each) over the native messaging mechanism to the native messaging host What is the expected result? Memory consumption of the extension process (Contains "--extension-process" on the command line shown in Windows task manager) does not grow up. What happens instead of that? Each serialized string of the data JSON object beeing sent is leaked in the extension process and the memory consumption grows up rapidly and does not go down any more when no more data is sent. When analyzing memory in F12/Memory in "Summary" I can see that JS memory consumption keeps low (the big data objects keep nowhere referenced, the sum of "Shallow Size" objects keeps constantly low), but when looking at the "Containment" section, every single big data objects is shown in the "(Global handles)" area as a single serialized string. Nowhere in the extension code the data beeing transferred is serialized in our code. According to the docs "(Global handles)" means objects from VM heap that are temporarily referenced from the currently running native code. The "Summary" section looks like: Code: 820 KB, Strings: 313 KB, JS Arrays: 23 KB, Typed Arrays: 0 KB, System Objects: 168301 KB, Total: 171044 KB. When running the exact same scenario with exactly the same extension code in Firefox, the data are not leaked (The sum of memory consumption of all Firefox processes shown in Windows task manager keeps nearly constant and does not explode). UserAgentString: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
,
Jul 28 2017
,
Jul 31 2017
dmnkholzl@ for further triage could you please help us with the sample extension and actual/expected behavior of this issue. Thank You...
,
Jul 31 2017
I've made a basic extension with is transferring 2M of json from popup to backgroud to popup. After running for 4H, no memory leaks were fun. The test was on Canary: Version 62.0.3169.0 (Official Build) canary (64-bit) Are you leaking a Port? Do you have a small snippet of code to repro?
,
Aug 21 2017
Thank you for looking at this, after some more tests I found out that memory goes up to about 2.5 GB as long as data are transferred, but if either reaching this "limit" or the process is no more busy and a few seconds later all the apparently leaked memory is freed at once and the process' memory shrinks down to about 300 MB. My test machine is a Windows Server 2012 R2 64-Bit with 16 GB RAM.
,
Aug 21 2017
Thank you for providing more feedback. Adding requester "kkaluri@chromium.org" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Aug 29 2017
As per comment#4, could you please provide us sample extension or file/URl/Jsfiddle/clear reproducible steps to triage this issue from TE end. Thanks in advance..!
,
Oct 12 2017
Since reporter hasn't responded for comment #7, closing this issue for now. dmnkholzl@ Could you please file a new bug if the issue still exists in latest chrome builds. Thanks! |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by ranjitkan@chromium.org
, Jul 26 2017