<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.vokipedia.de/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
		<id>http://www.vokipedia.de/index.php?action=history&amp;feed=atom&amp;title=Mechanically_Detect_Memory_Leaks_With_Puppeteer</id>
		<title>Mechanically Detect Memory Leaks With Puppeteer - Versionsgeschichte</title>
		<link rel="self" type="application/atom+xml" href="http://www.vokipedia.de/index.php?action=history&amp;feed=atom&amp;title=Mechanically_Detect_Memory_Leaks_With_Puppeteer"/>
		<link rel="alternate" type="text/html" href="http://www.vokipedia.de/index.php?title=Mechanically_Detect_Memory_Leaks_With_Puppeteer&amp;action=history"/>
		<updated>2026-04-23T14:31:29Z</updated>
		<subtitle>Versionsgeschichte dieser Seite in Vokipedia</subtitle>
		<generator>MediaWiki 1.19.23</generator>

	<entry>
		<id>http://www.vokipedia.de/index.php?title=Mechanically_Detect_Memory_Leaks_With_Puppeteer&amp;diff=100617&amp;oldid=prev</id>
		<title>AnnieRomo576 am 14. August 2025 um 11:33 Uhr</title>
		<link rel="alternate" type="text/html" href="http://www.vokipedia.de/index.php?title=Mechanically_Detect_Memory_Leaks_With_Puppeteer&amp;diff=100617&amp;oldid=prev"/>
				<updated>2025-08-14T11:33:51Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Nächstältere Version&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Version vom 14. August 2025, 11:33 Uhr&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;About half a yr ago Bronley Plumb kindly made me &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;aware &lt;/del&gt;of a memory leak in one &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;of &lt;/del&gt;my open-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;source &lt;/del&gt;packages. To see this memory leak in &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;motion &lt;/del&gt;it was essential to open a browser and its dev &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;tools &lt;/del&gt;to execute some &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;manual &lt;/del&gt;steps. On &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;high &lt;/del&gt;of that, the memory &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;had &lt;/del&gt;to be inspected manually. It was &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a complicated procedure&lt;/del&gt;. Normally I &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;simply &lt;/del&gt;add a failing &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;take a look at earlier than &lt;/del&gt;I repair a bug. This time it was a bit &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;more difficult&lt;/del&gt;. But &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ultimately &lt;/del&gt;I &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;found &lt;/del&gt;a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;method &lt;/del&gt;to test the memory consumption &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;automatically &lt;/del&gt;and here is what I &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;came &lt;/del&gt;up with. If you &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;are not involved within &lt;/del&gt;the adventurous path which led me to the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;solution &lt;/del&gt;be at liberty to skip proper to the end to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;read &lt;/del&gt;on from there. What &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/del&gt;a memory leak? &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Normally &lt;/del&gt;a memory leak is the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;situation wherein &lt;/del&gt;a software &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;program &lt;/del&gt;holds on to a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;bit &lt;/del&gt;of memory which it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;would &lt;/del&gt;not really &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;need &lt;/del&gt;anymore. In JavaScript this most &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;likely &lt;/del&gt;means that there's a reference to an object &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;someplace &lt;/del&gt;which you totally forgot about.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;But for&amp;#160; [https://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;live&lt;/del&gt;-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nine9&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;com&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;bbs/board.php?bo_table=free&amp;amp;wr_id=119428 Memory Wave&lt;/del&gt;] the garbage &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;assortment &lt;/del&gt;it's &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;not possible &lt;/del&gt;to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;tell apart &lt;/del&gt;between objects which are &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;still &lt;/del&gt;in use and people &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;which &lt;/del&gt;have &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;just &lt;/del&gt;been forgotten &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;somewhere&lt;/del&gt;. Historically a memory leak was something that &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;web developers &lt;/del&gt;did not &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;should &lt;/del&gt;care about. Each link on a page caused a new page to be loaded which in &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;turn &lt;/del&gt;wiped the memory. However memory leaks are &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;often &lt;/del&gt;very shy and solely &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;turn out to be &lt;/del&gt;noticeable when a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;selected &lt;/del&gt;program retains &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;running &lt;/del&gt;for a very long time. With todays Single Web page Purposes and Progressive &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Web &lt;/del&gt;Apps the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;state of affairs &lt;/del&gt;has &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;modified&lt;/del&gt;. Many &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;web sites &lt;/del&gt;do behave like apps and are designed to run for a long time and that is particularly true for apps that use the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;web &lt;/del&gt;Audio API. The memory leak in &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;query &lt;/del&gt;was found in standardized-audio-context which is a library to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;attain &lt;/del&gt;cross browser compatibility for that API. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;The &lt;/del&gt;most easy example of a memory leak that I could &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;think of &lt;/del&gt;is attaching some metadata to an object.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Let&lt;/del&gt;'&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;s say you have &lt;/del&gt;a few objects and you &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;want &lt;/del&gt;to retailer some metadata for &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;every &lt;/del&gt;of them. However you don't &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;need &lt;/del&gt;to set a property on those objects because you need to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;keep &lt;/del&gt;the metadata in a separate place. This can be solved &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;by using &lt;/del&gt;a Map as proven in the next snippet. It allows to retailer some metadata, to get it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;back &lt;/del&gt;and to delete it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;once more&lt;/del&gt;. All that is &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;required &lt;/del&gt;is a Map which &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;uses &lt;/del&gt;an object as the key to index its metadata. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;However &lt;/del&gt;what if an object with metadata &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will not be &lt;/del&gt;referenced anywhere else anymore? It nonetheless cannot be rubbish collected because the Map &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;still &lt;/del&gt;has a reference to it to index the metadata. The &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;following example &lt;/del&gt;is &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;after all &lt;/del&gt;contrived however many memory leaks &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;be &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;lowered &lt;/del&gt;to one thing as simple as this. All the created objects do survive &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;each rubbish assortment &lt;/del&gt;as a result of the Map still has a reference to them. This is the proper use case for a WeakMap.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The references held by a WeakMap don't &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;stop &lt;/del&gt;any object from being rubbish collected. By replacing the Map with a WeakMap this &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;frequent &lt;/del&gt;cause for a memory leak &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;can &lt;/del&gt;be &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;eradicated&lt;/del&gt;. The issue that precipitated the memory leak in my code was very &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;similar &lt;/del&gt;though it was not that &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;apparent &lt;/del&gt;to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;identify&lt;/del&gt;. Puppeteer is a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;instrument &lt;/del&gt;which can be used to remote management Chrome or &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;any &lt;/del&gt;other Chromium browser. It &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/del&gt;a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;less [http://dig.ccmixter.org/search?searchp=complicated complicated] different &lt;/del&gt;to Selenium and WebDriver &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;but &lt;/del&gt;it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;surely &lt;/del&gt;has the draw back that it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;solely &lt;/del&gt;works with browsers based &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;mostly &lt;/del&gt;on Chromium (for now). It comes with &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;entry &lt;/del&gt;to some APIs which &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;are not &lt;/del&gt;accessible by Selenium &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;because &lt;/del&gt;it tries to work together with &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a website like &lt;/del&gt;an &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;actual &lt;/del&gt;user. Puppeteer &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;alternatively &lt;/del&gt;has &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;access &lt;/del&gt;to many APIs which &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;are not &lt;/del&gt;accessible to normal &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;customers&lt;/del&gt;. This works by using the Chrome DevTools Protocol. A &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;kind &lt;/del&gt;of things that Puppeteer can do which Selenium &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;can't &lt;/del&gt;is inspecting the memory. And &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;this &lt;/del&gt;is &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;of course &lt;/del&gt;super useful when looking for memory leaks.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;At first look there appears to be a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;operate in &lt;/del&gt;the API of Puppeteer which &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gives &lt;/del&gt;all that is &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;needed &lt;/del&gt;to track the memory usage. It&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'s &lt;/del&gt;the page.metrics() technique. It does among &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;other &lt;/del&gt;things additionally return a metric &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;known as &lt;/del&gt;JSHeapUsedSize. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;That &lt;/del&gt;is the variety of bytes that V8, the JavaScript engine used in Chrome, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;makes use of &lt;/del&gt;as memory. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Unfortunately &lt;/del&gt;getting the size of the memory &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;shouldn't &lt;/del&gt;be &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;enough&lt;/del&gt;. The memory of a JavaScript program is managed by a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;really &lt;/del&gt;autonomous garbage assortment. Not like the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;rubbish assortment &lt;/del&gt;in the true world which usually &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;shows &lt;/del&gt;up on a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;really &lt;/del&gt;strict and well&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;-&lt;/del&gt;known schedule the JavaScript &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;rubbish collection &lt;/del&gt;does its job &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;whenever &lt;/del&gt;it thinks it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/del&gt;the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;proper &lt;/del&gt;time to do so. It &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;might normally &lt;/del&gt;not be triggered from &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;throughout &lt;/del&gt;the JavaScript code. But it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;surely &lt;/del&gt;is critical to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ensure &lt;/del&gt;it ran before inspecting the memory to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ensure &lt;/del&gt;that all the trash has been picked up and the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;[http://www.mecosys.com/bbs/board.php?bo_table=project_02&amp;amp;wr_id=6014646 Memory Wave Audio] &lt;/del&gt;consumption has been computed based on the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;newest modifications &lt;/del&gt;made by the code.&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;br&amp;gt;About half a yr ago Bronley Plumb kindly made me &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;conscious &lt;/ins&gt;of a memory leak in one &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;among &lt;/ins&gt;my open-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;supply &lt;/ins&gt;packages. To see this memory leak in &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;action &lt;/ins&gt;it was essential to open a browser and its dev &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;instruments &lt;/ins&gt;to execute some &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;guide &lt;/ins&gt;steps. On &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;top &lt;/ins&gt;of that, the memory &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;needed &lt;/ins&gt;to be inspected manually. It was &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;an advanced process&lt;/ins&gt;. Normally I &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;just &lt;/ins&gt;add a failing &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;test before &lt;/ins&gt;I repair a bug. This time it was a bit &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;extra tricky&lt;/ins&gt;. But &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;in the long run &lt;/ins&gt;I &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;discovered &lt;/ins&gt;a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;way &lt;/ins&gt;to test the memory consumption &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;routinely &lt;/ins&gt;and here is what I &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;got here &lt;/ins&gt;up with. If you &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;aren't interested in &lt;/ins&gt;the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[https://www.accountingweb.co.uk/search?search_api_views_fulltext=adventurous%20path &lt;/ins&gt;adventurous path&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;] &lt;/ins&gt;which led me to the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;answer &lt;/ins&gt;be at liberty to skip proper to the end to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;learn &lt;/ins&gt;on from there. What&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'s &lt;/ins&gt;a memory leak? &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In general &lt;/ins&gt;a memory leak is the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;state of affairs during which &lt;/ins&gt;a software holds on to a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;piece &lt;/ins&gt;of memory which it &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;does &lt;/ins&gt;not really &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;want &lt;/ins&gt;anymore. In JavaScript this most &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;definitely &lt;/ins&gt;means that there's a reference to an object &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;somewhere &lt;/ins&gt;which you totally forgot about.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;But for&amp;#160; [https://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;git&lt;/ins&gt;-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;test&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;zcy.dev&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;carina57637790 MemoryWave Official&lt;/ins&gt;] the garbage &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;collection &lt;/ins&gt;it's &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;impossible &lt;/ins&gt;to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;differentiate &lt;/ins&gt;between objects which are &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;nonetheless &lt;/ins&gt;in use and people &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;that &lt;/ins&gt;have &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;simply &lt;/ins&gt;been forgotten &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;someplace&lt;/ins&gt;. Historically a memory leak was something that &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;net builders &lt;/ins&gt;did not &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;need to &lt;/ins&gt;care about. Each link on a page caused a new page to be loaded which in &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;flip &lt;/ins&gt;wiped the memory. However memory leaks are &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;usually &lt;/ins&gt;very shy and solely &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;develop into &lt;/ins&gt;noticeable when a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;specific &lt;/ins&gt;program retains &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;operating &lt;/ins&gt;for a very long time. With todays Single Web page Purposes and Progressive &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Internet &lt;/ins&gt;Apps the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;situation &lt;/ins&gt;has &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;changed&lt;/ins&gt;. Many &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;websites &lt;/ins&gt;do behave like apps and are &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[https://www.reddit.com/r/howto/search?q=&lt;/ins&gt;designed &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;designed] &lt;/ins&gt;to run for a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;very &lt;/ins&gt;long time and that is particularly true for apps that use the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;net &lt;/ins&gt;Audio API. The memory leak in &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;question &lt;/ins&gt;was found in standardized-audio-context which is a library to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;achieve &lt;/ins&gt;cross browser compatibility for that API. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Probably the &lt;/ins&gt;most easy example of a memory leak that I could &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;consider &lt;/ins&gt;is attaching some metadata to an object.&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;For instance you&lt;/ins&gt;'&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ve gotten &lt;/ins&gt;a few objects and you &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;wish &lt;/ins&gt;to retailer some metadata for &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; [https://www.hanyunmedical.com/lanoramelbourn Memory Wave] each &lt;/ins&gt;of them. However you don't &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;wish &lt;/ins&gt;to set a property on those objects because you need to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;maintain &lt;/ins&gt;the metadata in a separate place. This can be solved &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;through the use of &lt;/ins&gt;a Map as proven in the next snippet. It allows to retailer some metadata, to get it &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;again &lt;/ins&gt;and to delete it &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;again&lt;/ins&gt;. All that is &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;needed &lt;/ins&gt;is a Map which &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;makes use of &lt;/ins&gt;an object as the key to index its metadata. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;But &lt;/ins&gt;what if an object with metadata &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;just isn't &lt;/ins&gt;referenced anywhere else anymore? It nonetheless cannot be rubbish collected because the Map &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;nonetheless &lt;/ins&gt;has a reference to it to index the metadata. The &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;next instance &lt;/ins&gt;is &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;in fact &lt;/ins&gt;contrived however many memory leaks &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;could &lt;/ins&gt;be &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;reduced &lt;/ins&gt;to one thing as simple as this. All the created objects do survive &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;every garbage collection &lt;/ins&gt;as a result of the Map still has a reference to them. This is the proper use case for a WeakMap.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The references held by a WeakMap don't &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;prevent &lt;/ins&gt;any object from being rubbish collected. By replacing the Map with a WeakMap this &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;widespread &lt;/ins&gt;cause for a memory leak &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;might &lt;/ins&gt;be &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;eliminated&lt;/ins&gt;. The issue that precipitated the memory leak in my code was very &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;related &lt;/ins&gt;though it was not that &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;obvious &lt;/ins&gt;to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;spot&lt;/ins&gt;. Puppeteer is a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;software &lt;/ins&gt;which can be used to remote management Chrome or &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;some &lt;/ins&gt;other Chromium browser. It&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'s &lt;/ins&gt;a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;simpler various &lt;/ins&gt;to Selenium and WebDriver &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;nevertheless &lt;/ins&gt;it has the draw back that it &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;only &lt;/ins&gt;works with browsers based on Chromium (for now). It comes with &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;access &lt;/ins&gt;to some APIs which &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;aren't &lt;/ins&gt;accessible by Selenium &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;as a result of &lt;/ins&gt;it tries to work together with an &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;internet site like a real &lt;/ins&gt;user. Puppeteer &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;then again &lt;/ins&gt;has &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;entry &lt;/ins&gt;to many APIs which &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;aren't &lt;/ins&gt;accessible to normal &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;users&lt;/ins&gt;. This works by using the Chrome DevTools Protocol. A &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;type &lt;/ins&gt;of things that Puppeteer can do which Selenium &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;cannot &lt;/ins&gt;is inspecting the memory. And &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;that &lt;/ins&gt;is &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;after all &lt;/ins&gt;super useful when looking for memory leaks.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;At first look there appears to be a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;perform within &lt;/ins&gt;the API of Puppeteer which &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;offers &lt;/ins&gt;all that is &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;required &lt;/ins&gt;to track the memory usage. It &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;web &lt;/ins&gt;page.metrics() technique. It does among &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;different &lt;/ins&gt;things additionally return a metric &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;called &lt;/ins&gt;JSHeapUsedSize. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;This &lt;/ins&gt;is the variety of bytes that V8, the JavaScript engine used in Chrome, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;uses &lt;/ins&gt;as memory. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Sadly &lt;/ins&gt;getting the size of the memory &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;will not &lt;/ins&gt;be &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;sufficient&lt;/ins&gt;. The memory of a JavaScript program is managed by a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;very &lt;/ins&gt;autonomous garbage assortment. Not like the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;garbage collection &lt;/ins&gt;in the true world which usually &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;exhibits &lt;/ins&gt;up on a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;very &lt;/ins&gt;strict and well known schedule the JavaScript &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;garbage assortment &lt;/ins&gt;does its job &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;each time &lt;/ins&gt;it thinks it&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'s &lt;/ins&gt;the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;fitting &lt;/ins&gt;time to do so. It &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;can usually &lt;/ins&gt;not be triggered from &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;inside &lt;/ins&gt;the JavaScript code. But it is critical to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;make sure &lt;/ins&gt;it ran before inspecting the memory to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;be sure &lt;/ins&gt;that all the trash has been picked up and the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;memory &lt;/ins&gt;consumption has been computed based &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;mostly &lt;/ins&gt;on the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;most recent changes &lt;/ins&gt;made by the code.&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AnnieRomo576</name></author>	</entry>

	<entry>
		<id>http://www.vokipedia.de/index.php?title=Mechanically_Detect_Memory_Leaks_With_Puppeteer&amp;diff=90487&amp;oldid=prev</id>
		<title>LiliaMaki746: Die Seite wurde neu angelegt: „&lt;br&gt;About half a yr ago Bronley Plumb kindly made me aware of a memory leak in one of my open-source packages. To see this memory leak in motion it was essenti…“</title>
		<link rel="alternate" type="text/html" href="http://www.vokipedia.de/index.php?title=Mechanically_Detect_Memory_Leaks_With_Puppeteer&amp;diff=90487&amp;oldid=prev"/>
				<updated>2025-08-07T17:33:21Z</updated>
		
		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „&amp;lt;br&amp;gt;About half a yr ago Bronley Plumb kindly made me aware of a memory leak in one of my open-source packages. To see this memory leak in motion it was essenti…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;br&amp;gt;About half a yr ago Bronley Plumb kindly made me aware of a memory leak in one of my open-source packages. To see this memory leak in motion it was essential to open a browser and its dev tools to execute some manual steps. On high of that, the memory had to be inspected manually. It was a complicated procedure. Normally I simply add a failing take a look at earlier than I repair a bug. This time it was a bit more difficult. But ultimately I found a method to test the memory consumption automatically and here is what I came up with. If you are not involved within the adventurous path which led me to the solution be at liberty to skip proper to the end to read on from there. What is a memory leak? Normally a memory leak is the situation wherein a software program holds on to a bit of memory which it would not really need anymore. In JavaScript this most likely means that there's a reference to an object someplace which you totally forgot about.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;But for  [https://live-nine9.com/bbs/board.php?bo_table=free&amp;amp;wr_id=119428 Memory Wave] the garbage assortment it's not possible to tell apart between objects which are still in use and people which have just been forgotten somewhere. Historically a memory leak was something that web developers did not should care about. Each link on a page caused a new page to be loaded which in turn wiped the memory. However memory leaks are often very shy and solely turn out to be noticeable when a selected program retains running for a very long time. With todays Single Web page Purposes and Progressive Web Apps the state of affairs has modified. Many web sites do behave like apps and are designed to run for a long time and that is particularly true for apps that use the web Audio API. The memory leak in query was found in standardized-audio-context which is a library to attain cross browser compatibility for that API. The most easy example of a memory leak that I could think of is attaching some metadata to an object.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Let's say you have a few objects and you want to retailer some metadata for every of them. However you don't need to set a property on those objects because you need to keep the metadata in a separate place. This can be solved by using a Map as proven in the next snippet. It allows to retailer some metadata, to get it back and to delete it once more. All that is required is a Map which uses an object as the key to index its metadata. However what if an object with metadata will not be referenced anywhere else anymore? It nonetheless cannot be rubbish collected because the Map still has a reference to it to index the metadata. The following example is after all contrived however many memory leaks will be lowered to one thing as simple as this. All the created objects do survive each rubbish assortment as a result of the Map still has a reference to them. This is the proper use case for a WeakMap.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;The references held by a WeakMap don't stop any object from being rubbish collected. By replacing the Map with a WeakMap this frequent cause for a memory leak can be eradicated. The issue that precipitated the memory leak in my code was very similar though it was not that apparent to identify. Puppeteer is a instrument which can be used to remote management Chrome or any other Chromium browser. It is a less [http://dig.ccmixter.org/search?searchp=complicated complicated] different to Selenium and WebDriver but it surely has the draw back that it solely works with browsers based mostly on Chromium (for now). It comes with entry to some APIs which are not accessible by Selenium because it tries to work together with a website like an actual user. Puppeteer alternatively has access to many APIs which are not accessible to normal customers. This works by using the Chrome DevTools Protocol. A kind of things that Puppeteer can do which Selenium can't is inspecting the memory. And this is of course super useful when looking for memory leaks.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;At first look there appears to be a operate in the API of Puppeteer which gives all that is needed to track the memory usage. It's the page.metrics() technique. It does among other things additionally return a metric known as JSHeapUsedSize. That is the variety of bytes that V8, the JavaScript engine used in Chrome, makes use of as memory. Unfortunately getting the size of the memory shouldn't be enough. The memory of a JavaScript program is managed by a really autonomous garbage assortment. Not like the rubbish assortment in the true world which usually shows up on a really strict and well-known schedule the JavaScript rubbish collection does its job whenever it thinks it is the proper time to do so. It might normally not be triggered from throughout the JavaScript code. But it surely is critical to ensure it ran before inspecting the memory to ensure that all the trash has been picked up and the [http://www.mecosys.com/bbs/board.php?bo_table=project_02&amp;amp;wr_id=6014646 Memory Wave Audio] consumption has been computed based on the newest modifications made by the code.&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>LiliaMaki746</name></author>	</entry>

	</feed>