| <!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1.0"><link rel=icon href=https://nodejs.org/static/images/favicons/favicon.png><title>Memory | Node.js Learn</title><meta name=description content="Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts."><link rel=stylesheet href=https://nodejs.org/learn/styles.css><meta property=og:title content="Memory | Node.js Learn"><meta property=og:description content="Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts."><meta property=og:image content=https://nodejs.org/en/next-data/og/announcement/Node.js%20%E2%80%94%20Run%20JavaScript%20Everywhere><meta property=og:type content=website><link rel=canonical href=https://nodejs.org/learn/diagnostics/memory><link rel=preconnect href=https://fonts.googleapis.com><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=stylesheet href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono&family=Open+Sans:ital,wght@0,300..800;1,300..800"><script>document.documentElement.setAttribute("data-theme",document.documentElement.style.colorScheme=localStorage.getItem("theme")||(matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"))</script><script type=importmap>{"imports":{"https://nodejs.org/learn/FunctionSignature-B--JQsy2.js":"https://nodejs.org/learn/FunctionSignature-B1xS7KHL.js","https://nodejs.org/learn/am-CadQaWIg.js":"https://nodejs.org/learn/am-DD6wLtla.js","https://nodejs.org/learn/ar-B9j3rcdQ.js":"https://nodejs.org/learn/ar-BqV5m5Su.js","https://nodejs.org/learn/bg-BZyjxg94.js":"https://nodejs.org/learn/bg-BHYiO7jC.js","https://nodejs.org/learn/de-C4KY0ajo.js":"https://nodejs.org/learn/de-C-6MZcIZ.js","https://nodejs.org/learn/dk-euX_mAD7.js":"https://nodejs.org/learn/dk-DkrQYV5V.js","https://nodejs.org/learn/en-zkyS8duI.js":"https://nodejs.org/learn/en-BDbN4u62.js","https://nodejs.org/learn/es-C7ThI7RH.js":"https://nodejs.org/learn/es-DByyFciM.js","https://nodejs.org/learn/fi-BMNinnrS.js":"https://nodejs.org/learn/fi-CVjBpij1.js","https://nodejs.org/learn/fr-5HZxfnRv.js":"https://nodejs.org/learn/fr-Cd_rP5eJ.js","https://nodejs.org/learn/gr-Ch3xlQyV.js":"https://nodejs.org/learn/gr-DQ_Cx_db.js","https://nodejs.org/learn/hu-BmZk33Nb.js":"https://nodejs.org/learn/hu-B_qNoTXG.js","https://nodejs.org/learn/id-DRkIAkgJ.js":"https://nodejs.org/learn/id-dOWq1ebe.js","https://nodejs.org/learn/ie-BKOfO08o.js":"https://nodejs.org/learn/ie-DnEdpmYD.js","https://nodejs.org/learn/in-BgIRD3D8.js":"https://nodejs.org/learn/in-C1YDU6CQ.js","https://nodejs.org/learn/it-DxrcW74z.js":"https://nodejs.org/learn/it-BuFj2SuP.js","https://nodejs.org/learn/ja-CkLYPxmZ.js":"https://nodejs.org/learn/ja-DO3ZiUo9.js","https://nodejs.org/learn/lt-Cw-3R7X2.js":"https://nodejs.org/learn/lt-BUxPUwMh.js","https://nodejs.org/learn/nl-KwmA1W7w.js":"https://nodejs.org/learn/nl-CcRbIUFb.js","https://nodejs.org/learn/no-DLdTGnEH.js":"https://nodejs.org/learn/no-CTGt9hCY.js","https://nodejs.org/learn/np-BwumwDEo.js":"https://nodejs.org/learn/np-BihsWFRw.js","https://nodejs.org/learn/pt-BFyWaLMJ.js":"https://nodejs.org/learn/pt-CyPz7Wle.js","https://nodejs.org/learn/ro-BV-UeEHg.js":"https://nodejs.org/learn/ro-s9yiCfKf.js","https://nodejs.org/learn/rs-egXs3oAP.js":"https://nodejs.org/learn/rs-DPQdrJ_W.js","https://nodejs.org/learn/ru-YSHZBJMr.js":"https://nodejs.org/learn/ru-CMljlVpk.js","https://nodejs.org/learn/se-CeRGWCm8.js":"https://nodejs.org/learn/se-BBqt4-2d.js","https://nodejs.org/learn/sk-BP8WzYuH.js":"https://nodejs.org/learn/sk-C1Qdt6f8.js","https://nodejs.org/learn/ta-DXs2JhCz.js":"https://nodejs.org/learn/ta-CMS_1_vC.js","https://nodejs.org/learn/tr-n1cPfTZI.js":"https://nodejs.org/learn/tr-DXYIqLIN.js","https://nodejs.org/learn/uk-gGie7iXX.js":"https://nodejs.org/learn/uk-V2cww1HO.js","https://nodejs.org/learn/zh-bMXbjpd5.js":"https://nodejs.org/learn/zh-CEb7ckIk.js"}}</script><script type=speculationrules>{"prefetch":[{"eagerness":"eager","where":{"href_matches":"/*"}}],"prerender":[{"eagerness":"moderate","where":{"selector_matches":"[rel~=prefetch]"}}]}</script><div id=root><nav class=xGdRsq_container><div class=xGdRsq_innerContainer><div class=xGdRsq_nodeIconAndMobileItemsToggler><a href=/ aria-label=Home class=xGdRsq_nodeIconWrapper><svg width=267 height=80 viewBox="0 0 267 80" fill=none class="Su--4q_nodejsLogo dark:fill-white fill-[#333333]"><mask id=a maskUnits=userSpaceOnUse x=0 y=0 width=267 height=80 style=mask-type:luminance;><path d="M267 0H0v79.378h267z" fill=#fff /></mask><g mask=url(#a)><path d="M234.983 78.755a4 4 0 0 1-1.933-.51l-6.121-3.658c-.921-.51-.46-.695-.184-.787 1.242-.417 1.472-.51 2.761-1.25.138-.093.322-.047.46.046l4.694 2.825c.184.092.414.092.552 0l18.363-10.698c.183-.092.277-.277.277-.509V42.867c0-.232-.094-.417-.277-.51l-18.363-10.65c-.184-.093-.414-.093-.552 0l-18.362 10.65c-.184.093-.276.324-.276.51v21.347c0 .186.092.417.276.51l5.016 2.917c2.715 1.39 4.418-.232 4.418-1.852v-21.07c0-.278.23-.556.553-.556h2.347c.276 0 .552.232.552.556v21.07c0 3.658-1.979 5.788-5.431 5.788-1.058 0-1.886 0-4.234-1.157l-4.832-2.779a3.91 3.91 0 0 1-1.933-3.38V42.912c0-1.39.737-2.686 1.933-3.38l18.363-10.697c1.15-.649 2.715-.649 3.865 0l18.363 10.696a3.91 3.91 0 0 1 1.932 3.381V64.26c0 1.39-.736 2.686-1.932 3.381l-18.363 10.697c-.552.232-1.242.417-1.932.417" fill=#5FA04E /><path d="M240.69 64.075c-8.055 0-9.712-3.705-9.712-6.854 0-.277.23-.555.552-.555h2.393c.277 0 .507.185.507.463.368 2.454 1.426 3.658 6.305 3.658 3.866 0 5.523-.88 5.523-2.963 0-1.204-.462-2.084-6.49-2.686-5.016-.51-8.146-1.621-8.146-5.65 0-3.75 3.13-5.974 8.376-5.974 5.892 0 8.791 2.038 9.159 6.484a.76.76 0 0 1-.137.416c-.094.093-.231.186-.371.186h-2.439a.54.54 0 0 1-.505-.417c-.553-2.547-1.98-3.38-5.753-3.38-4.234 0-4.74 1.481-4.74 2.593 0 1.342.598 1.76 6.305 2.5 5.66.741 8.33 1.806 8.33 5.788 0 4.076-3.36 6.391-9.157 6.391m26.51-22.413c0 1.945-1.612 3.566-3.546 3.566a3.556 3.556 0 0 1-3.543-3.566 3.556 3.556 0 0 1 3.543-3.565c1.888 0 3.546 1.574 3.546 3.565m-6.536 0c0 1.667 1.335 3.01 2.944 3.01 1.658 0 2.993-1.39 2.993-3.01 0-1.667-1.335-2.963-2.993-2.963a2.975 2.975 0 0 0-2.944 2.963m1.657-1.991h1.381c.46 0 1.381 0 1.381 1.065 0 .74-.462.88-.739.973.554.046.599.416.645.926.046.324.094.88.185 1.065h-.83c0-.186-.137-1.204-.137-1.25-.045-.232-.137-.325-.413-.325h-.691v1.62h-.782zm.736 1.76h.597c.508 0 .599-.37.599-.556 0-.556-.368-.556-.599-.556h-.642v1.112z" fill=#5FA04E /><path fill-rule=evenodd clip-rule=evenodd d="M43.674 41.954c0-.834-.46-1.62-1.197-2.038L23.01 28.572c-.322-.185-.69-.278-1.058-.324h-.184c-.368 0-.736.139-1.059.324l-19.512 11.3A2.38 2.38 0 0 0 0 41.953l.046 30.378c0 .416.23.833.598 1.018.368.232.829.232 1.15 0l11.598-6.668a2.36 2.36 0 0 0 1.197-2.037V50.428c0-.833.46-1.62 1.196-2.037l4.924-2.871a2.2 2.2 0 0 1 1.197-.325c.414 0 .828.093 1.15.325l4.925 2.87a2.36 2.36 0 0 1 1.196 2.038v14.217c0 .833.46 1.62 1.197 2.037l11.505 6.668c.368.232.828.232 1.197 0 .368-.185.598-.602.598-1.018zM137.465.139c-.369-.185-.829-.185-1.151 0-.368.231-.598.602-.598 1.019v30.1a.89.89 0 0 1-.415.74.88.88 0 0 1-.828 0l-4.878-2.825a2.36 2.36 0 0 0-2.347 0L107.735 40.52a2.36 2.36 0 0 0-1.196 2.037V65.2c0 .834.46 1.621 1.196 2.038l19.513 11.345a2.36 2.36 0 0 0 2.347 0l19.513-11.345a2.36 2.36 0 0 0 1.196-2.038V8.752c0-.88-.46-1.667-1.196-2.084zm-1.795 57.606c0 .232-.092.417-.276.51l-6.674 3.89a.68.68 0 0 1-.598 0l-6.673-3.89c-.184-.093-.276-.325-.276-.51v-7.78c0-.231.092-.416.276-.509l6.673-3.89a.68.68 0 0 1 .598 0l6.674 3.89c.184.093.276.324.276.51zm66.728-7.965c.737-.417 1.151-1.204 1.151-2.038v-5.51c0-.834-.46-1.62-1.151-2.037l-19.375-11.3a2.36 2.36 0 0 0-2.347 0l-19.512 11.346a2.36 2.36 0 0 0-1.197 2.037v22.645c0 .833.46 1.62 1.197 2.037l19.374 11.114c.737.416 1.611.416 2.301 0l11.736-6.576c.368-.185.598-.602.598-1.019s-.23-.833-.598-1.018L174.97 58.115c-.368-.231-.598-.602-.598-1.018v-7.085c0-.417.23-.834.598-1.02l6.121-3.518a1.12 1.12 0 0 1 1.196 0l6.121 3.519c.368.231.598.602.598 1.019v5.557c0 .416.23.833.599 1.018.368.232.828.232 1.196 0z"/><path fill-rule=evenodd clip-rule=evenodd d="M181.551 48.716a.42.42 0 0 1 .461 0l3.727 2.176c.138.092.23.231.23.417v4.352a.49.49 0 0 1-.23.417l-3.727 2.177a.42.42 0 0 1-.461 0l-3.727-2.177a.49.49 0 0 1-.23-.417V51.31c0-.185.092-.325.23-.417z" fill=#5FA04E /><g transform="translate(53.428, 28.628)"><g><path fill=url(#b) d="M22.873.417a2.36 2.36 0 0 0-2.348 0L1.151 11.669C.414 12.086 0 12.873 0 13.707v22.551c0 .834.46 1.621 1.15 2.038l19.375 11.253a2.36 2.36 0 0 0 2.348 0l19.374-11.253c.737-.417 1.15-1.204 1.15-2.038V13.707c0-.834-.46-1.62-1.15-2.038z"/><path fill=url(#c) clip-path=url(#d) d="m21.699-1.047 21.506 12.995L21.7 51.073.153 38.055z"/><path fill=url(#e) clip-path=url(#d) d="M21.699-1.047.153 11.948l21.546 39.125 21.506-13.018z"/></g></g></g><defs><linearGradient id=b x1=30.33 y1=8.56 x2=14.9 y2=44.7 gradientUnits=userSpaceOnUse><stop stop-color=#3F8B3D /><stop offset=0.64 stop-color=#3F873F /><stop offset=0.93 stop-color=#3DA92E /><stop offset=1 stop-color=#3DAE2B /></linearGradient><linearGradient id=c x1=18.8 y1=26.8 x2=68 y2=0.4 gradientUnits=userSpaceOnUse><stop offset=0.14 stop-color=#3F873F /><stop offset=0.4 stop-color=#52A044 /><stop offset=0.71 stop-color=#64B749 /><stop offset=0.91 stop-color=#6ABF4B /></linearGradient><linearGradient id=e x1=0.25 y1=24.5 x2=44 y2=24.5 gradientUnits=userSpaceOnUse><stop offset=0.09 stop-color=#6ABF4B /><stop offset=0.29 stop-color=#64B749 /><stop offset=0.6 stop-color=#52A044 /><stop offset=0.86 stop-color=#3F873F /></linearGradient><clipPath id=d><path d="M22.873.417a2.36 2.36 0 0 0-2.348 0L1.151 11.669C.414 12.086 0 12.873 0 13.707v22.551c0 .834.46 1.621 1.15 2.038l19.375 11.253a2.36 2.36 0 0 0 2.348 0l19.374-11.253c.737-.417 1.15-1.204 1.15-2.038V13.707c0-.834-.46-1.62-1.15-2.038z"/></clipPath></defs></svg></a><label for=sidebarItemToggler role=button aria-label="Toggle navigation menu" class=xGdRsq_sidebarItemTogglerLabel><svg viewBox="0 0 24 24" fill=currentColor aria-hidden=true data-slot=icon class=xGdRsq_navInteractionIcon><path fill-rule=evenodd d="M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z" clip-rule=evenodd /></svg></label></div><input id=sidebarItemToggler type=checkbox aria-label="Toggle navigation menu" tabindex=-1 class="peer xGdRsq_sidebarItemToggler"><div class="hidden peer-checked:flex xGdRsq_main"><div class=xGdRsq_navItems><a href=/learn class="J9yHBG_nav J9yHBG_navItem"><span class=J9yHBG_label>Learn</span></a><a href=/about class="J9yHBG_nav J9yHBG_navItem"><span class=J9yHBG_label>About</span></a><a href=/download class="J9yHBG_nav J9yHBG_navItem"><span class=J9yHBG_label>Download</span></a><a href=/blog class="J9yHBG_nav J9yHBG_navItem"><span class=J9yHBG_label>Blog</span></a><a href=/docs/latest/api/ class="J9yHBG_nav J9yHBG_navItem"><span class=J9yHBG_label>Docs</span></a><a href=https://github.com/nodejs/node/blob/main/CONTRIBUTING.md target=_blank class="J9yHBG_nav J9yHBG_navItem"><span class=J9yHBG_label>Contibute</span><svg viewBox="0 0 24 24" fill=currentColor aria-hidden=true data-slot=icon class=J9yHBG_icon><path fill-rule=evenodd d="M8.25 3.75H19.5a.75.75 0 0 1 .75.75v11.25a.75.75 0 0 1-1.5 0V6.31L5.03 20.03a.75.75 0 0 1-1.06-1.06L17.69 5.25H8.25a.75.75 0 0 1 0-1.5Z" clip-rule=evenodd /></svg></a><a href=https://training.linuxfoundation.org/openjs/ target=_blank class="J9yHBG_nav J9yHBG_navItem"><span class=J9yHBG_label>Courses</span><svg viewBox="0 0 24 24" fill=currentColor aria-hidden=true data-slot=icon class=J9yHBG_icon><path fill-rule=evenodd d="M8.25 3.75H19.5a.75.75 0 0 1 .75.75v11.25a.75.75 0 0 1-1.5 0V6.31L5.03 20.03a.75.75 0 0 1-1.06-1.06L17.69 5.25H8.25a.75.75 0 0 1 0-1.5Z" clip-rule=evenodd /></svg></a></div><div class=xGdRsq_actionsWrapper><div class=nNvk8a_searchboxContainer><button type=button disabled class=nNvk8a_searchButton><div class=nNvk8a_searchButtonContent><svg viewBox="0 0 24 24" fill=currentColor aria-hidden=true data-slot=icon><path fill-rule=evenodd d="M10.5 3.75a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.25 10.5a8.25 8.25 0 1 1 14.59 5.28l4.69 4.69a.75.75 0 1 1-1.06 1.06l-4.69-4.69A8.25 8.25 0 0 1 2.25 10.5Z" clip-rule=evenodd /></svg>Start typing...</div><span class=nNvk8a_searchButtonShortcut>⌘ K</span></button></div><button type=button id=radix-P0-0 aria-haspopup=menu aria-expanded=false data-state=closed class=_5sMJ1a_themeToggle><svg fill=none viewBox="0 0 24 24" stroke-width=1.5 stroke=currentColor aria-hidden=true data-slot=icon height=20><path stroke-linecap=round stroke-linejoin=round d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"/></svg></button><a href=https://github.com/nodejs/learn class=xGdRsq_ghIconWrapper><svg width=20 height=20 viewBox="0 0 20 20" fill=currentColor><path d="M10 1.25C5.16562 1.25 1.25 5.16562 1.25 10C1.25 13.8719 3.75469 17.1422 7.23281 18.3016C7.67031 18.3781 7.83437 18.1156 7.83437 17.8859C7.83437 17.6781 7.82344 16.9891 7.82344 16.2563C5.625 16.6609 5.05625 15.7203 4.88125 15.2281C4.78281 14.9766 4.35625 14.2 3.98438 13.9922C3.67812 13.8281 3.24063 13.4234 3.97344 13.4125C4.6625 13.4016 5.15469 14.0469 5.31875 14.3094C6.10625 15.6328 7.36406 15.2609 7.86719 15.0312C7.94375 14.4625 8.17344 14.0797 8.425 13.8609C6.47813 13.6422 4.44375 12.8875 4.44375 9.54062C4.44375 8.58906 4.78281 7.80156 5.34062 7.18906C5.25313 6.97031 4.94687 6.07344 5.42812 4.87031C5.42812 4.87031 6.16094 4.64063 7.83437 5.76719C8.53438 5.57031 9.27813 5.47187 10.0219 5.47187C10.7656 5.47187 11.5094 5.57031 12.2094 5.76719C13.8828 4.62969 14.6156 4.87031 14.6156 4.87031C15.0969 6.07344 14.7906 6.97031 14.7031 7.18906C15.2609 7.80156 15.6 8.57812 15.6 9.54062C15.6 12.8984 13.5547 13.6422 11.6078 13.8609C11.925 14.1344 12.1984 14.6594 12.1984 15.4797C12.1984 16.65 12.1875 17.5906 12.1875 17.8859C12.1875 18.1156 12.3516 18.3891 12.7891 18.3016C14.5261 17.7152 16.0355 16.5988 17.1048 15.1096C18.1741 13.6204 18.7495 11.8333 18.75 10C18.75 5.16562 14.8344 1.25 10 1.25Z"/></svg></a></div></div></div></nav><div class=WtL_ua_articleLayout><aside class=_3ChhEq_wrapper><span class="_3ChhEq_mobileSelect iUF1YW_select select-P02"><label for=P0-3 class=iUF1YW_label>Navigation</label><button type=button role=combobox aria-controls=radix-P0-4 aria-expanded=false aria-autocomplete=none dir=ltr data-state=closed data-placeholder id=P0-3 class=iUF1YW_trigger><span style=pointer-events:none;></span><svg fill=none viewBox="0 0 24 24" stroke-width=1.5 stroke=currentColor aria-hidden=true data-slot=icon class=iUF1YW_icon><path stroke-linecap=round stroke-linejoin=round d="m19.5 8.25-7.5 7.5-7.5-7.5"/></svg></button><select aria-hidden=true tabindex=-1 style="position:absolute;border:0px;width:1px;height:1px;padding:0px;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;word-wrap:normal;"><option value></select></span><noscript><style>.select-P02{display:none!important}</style><div class="_3ChhEq_mobileSelect iUF1YW_noscript iUF1YW_select"><label for=P0-5 class=iUF1YW_label>Navigation</label><details id=P0-5 class=iUF1YW_trigger><summary aria-disabled=false><span></span><svg viewBox="0 0 24 24" fill=currentColor aria-hidden=true data-slot=icon class=iUF1YW_icon><path fill-rule=evenodd d="M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z" clip-rule=evenodd /></svg></summary><div class=iUF1YW_dropdown><div><div class="iUF1YW_item iUF1YW_label">Getting Started</div><a href=/learn/getting-started/introduction-to-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Introduction to Node.js</span></a><a href=/learn/getting-started/how-much-javascript-do-you-need-to-know-to-use-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>How much JavaScript do you need to know to use Node.js?</span></a><a href=/learn/getting-started/differences-between-nodejs-and-the-browser aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Differences between Node.js and the Browser</span></a><a href=/learn/getting-started/the-v8-javascript-engine aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>The V8 JavaScript Engine</span></a><a href=/learn/getting-started/an-introduction-to-the-npm-package-manager aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>An introduction to the npm package manager</span></a><a href=/learn/getting-started/ecmascript-2015-es6-and-beyond aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>ECMAScript 2015 (ES6) and beyond</span></a><a href=/learn/getting-started/debugging aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Debugging Node.js</span></a><a href=/learn/getting-started/fetch aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Fetching data with Node.js</span></a><a href=/learn/getting-started/websocket aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>WebSocket client with Node.js</span></a><a href=/learn/getting-started/nodejs-the-difference-between-development-and-production aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Node.js, the difference between development and production</span></a><a href=/learn/getting-started/profiling aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Profiling Node.js Applications</span></a><a href=/learn/getting-started/nodejs-with-webassembly aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Node.js with WebAssembly</span></a><a href=/learn/getting-started/security-best-practices aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Security Best Practices</span></a><a href=/learn/getting-started/userland-migrations aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Introduction to Userland Migrations</span></a></div><div><div class="iUF1YW_item iUF1YW_label">Command Line</div><a href=/learn/command-line/run-nodejs-scripts-from-the-command-line aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Run Node.js scripts from the command line</span></a><a href=/learn/command-line/how-to-use-the-nodejs-repl aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>How to use the Node.js REPL</span></a><a href=/learn/command-line/output-to-the-command-line-using-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Output to the command line using Node.js</span></a><a href=/learn/command-line/accept-input-from-the-command-line-in-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Accept input from the command line in Node.js</span></a><a href=/learn/command-line/how-to-read-environment-variables-from-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>How to read environment variables from Node.js</span></a></div><div><div class="iUF1YW_item iUF1YW_label">HTTP</div><a href=/learn/http/anatomy-of-an-http-transaction aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Anatomy of an HTTP Transaction</span></a><a href=/learn/http/enterprise-network-configuration aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Enterprise Network Configuration</span></a></div><div><div class="iUF1YW_item iUF1YW_label">Manipulating Files</div><a href=/learn/manipulating-files/nodejs-file-stats aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Node.js file stats</span></a><a href=/learn/manipulating-files/nodejs-file-paths aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Node.js File Paths</span></a><a href=/learn/manipulating-files/reading-files-with-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Reading files with Node.js</span></a><a href=/learn/manipulating-files/writing-files-with-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Writing files with Node.js</span></a><a href=/learn/manipulating-files/working-with-file-descriptors-in-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Working with file descriptors in Node.js</span></a><a href=/learn/manipulating-files/working-with-folders-in-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Working with folders in Node.js</span></a><a href=/learn/manipulating-files/working-with-different-filesystems aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>How to work with Different Filesystems</span></a></div><div><div class="iUF1YW_item iUF1YW_label">Asynchronous Work</div><a href=/learn/asynchronous-work/javascript-asynchronous-programming-and-callbacks aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>JavaScript Asynchronous Programming and Callbacks</span></a><a href=/learn/asynchronous-work/asynchronous-flow-control aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Asynchronous flow control</span></a><a href=/learn/asynchronous-work/discover-promises-in-nodejs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Discover Promises in Node.js</span></a><a href=/learn/asynchronous-work/discover-javascript-timers aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Discover JavaScript Timers</span></a><a href=/learn/asynchronous-work/overview-of-blocking-vs-non-blocking aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Overview of Blocking vs Non-Blocking</span></a><a href=/learn/asynchronous-work/event-loop-timers-and-nexttick aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>The Node.js Event Loop</span></a><a href=/learn/asynchronous-work/the-nodejs-event-emitter aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>The Node.js Event Emitter</span></a><a href=/learn/asynchronous-work/understanding-processnexttick aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Understanding process.nextTick()</span></a><a href=/learn/asynchronous-work/understanding-setimmediate aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Understanding setImmediate()</span></a><a href=/learn/asynchronous-work/dont-block-the-event-loop aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Don't Block the Event Loop</span></a></div><div><div class="iUF1YW_item iUF1YW_label">TypeScript</div><a href=/learn/typescript/introduction aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Introduction to TypeScript</span></a><a href=/learn/typescript/run-natively aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Running TypeScript Natively</span></a><a href=/learn/typescript/transpile aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Running TypeScript code using transpilation</span></a><a href=/learn/typescript/run aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Running TypeScript with a runner</span></a><a href=/learn/typescript/publishing-a-ts-package aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Publishing a TypeScript package</span></a></div><div><div class="iUF1YW_item iUF1YW_label">Modules</div><a href=/learn/modules/how-to-use-streams aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>How to use streams</span></a><a href=/learn/modules/backpressuring-in-streams aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Backpressuring in Streams</span></a><a href=/learn/modules/publishing-a-package aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Publishing a package</span></a><a href=/learn/modules/publishing-node-api-modules aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>How to publish a Node-API package</span></a><a href=/learn/modules/abi-stability aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>ABI Stability</span></a></div><div><div class="iUF1YW_item iUF1YW_label">Diagnostics</div><a href=/learn/diagnostics/user-journey aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>User Journey</span></a><a href=/learn/diagnostics/memory aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Memory</span></a><a href=/learn/diagnostics/live-debugging aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Live Debugging</span></a><a href=/learn/diagnostics/poor-performance aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Poor Performance</span></a><a href=/learn/diagnostics/flame-graphs aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Flame Graphs</span></a></div><div><div class="iUF1YW_item iUF1YW_label">Test Runner</div><a href=/learn/test-runner/introduction aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Discovering Node.js's test runner</span></a><a href=/learn/test-runner/using-test-runner aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Using Node.js's test runner</span></a><a href=/learn/test-runner/mocking aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Mocking in tests</span></a><a href=/learn/test-runner/collecting-code-coverage aria-disabled=false rel=prefetch class="iUF1YW_item iUF1YW_text"><span>Collecting code coverage in Node.js</span></a></div></div></details></div></noscript><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>Getting Started</label><ul class=sRlY2a_itemList><li><a href=/learn/getting-started/introduction-to-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Introduction to Node.js</span></div></a><li><a href=/learn/getting-started/how-much-javascript-do-you-need-to-know-to-use-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>How much JavaScript do you need to know to use Node.js?</span></div></a><li><a href=/learn/getting-started/differences-between-nodejs-and-the-browser rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Differences between Node.js and the Browser</span></div></a><li><a href=/learn/getting-started/the-v8-javascript-engine rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>The V8 JavaScript Engine</span></div></a><li><a href=/learn/getting-started/an-introduction-to-the-npm-package-manager rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>An introduction to the npm package manager</span></div></a><li><a href=/learn/getting-started/ecmascript-2015-es6-and-beyond rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>ECMAScript 2015 (ES6) and beyond</span></div></a><li><a href=/learn/getting-started/debugging rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Debugging Node.js</span></div></a><li><a href=/learn/getting-started/fetch rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Fetching data with Node.js</span></div></a><li><a href=/learn/getting-started/websocket rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>WebSocket client with Node.js</span></div></a><li><a href=/learn/getting-started/nodejs-the-difference-between-development-and-production rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Node.js, the difference between development and production</span></div></a><li><a href=/learn/getting-started/profiling rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Profiling Node.js Applications</span></div></a><li><a href=/learn/getting-started/nodejs-with-webassembly rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Node.js with WebAssembly</span></div></a><li><a href=/learn/getting-started/security-best-practices rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Security Best Practices</span></div></a><li><a href=/learn/getting-started/userland-migrations rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Introduction to Userland Migrations</span></div></a></ul></section><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>Command Line</label><ul class=sRlY2a_itemList><li><a href=/learn/command-line/run-nodejs-scripts-from-the-command-line rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Run Node.js scripts from the command line</span></div></a><li><a href=/learn/command-line/how-to-use-the-nodejs-repl rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>How to use the Node.js REPL</span></div></a><li><a href=/learn/command-line/output-to-the-command-line-using-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Output to the command line using Node.js</span></div></a><li><a href=/learn/command-line/accept-input-from-the-command-line-in-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Accept input from the command line in Node.js</span></div></a><li><a href=/learn/command-line/how-to-read-environment-variables-from-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>How to read environment variables from Node.js</span></div></a></ul></section><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>HTTP</label><ul class=sRlY2a_itemList><li><a href=/learn/http/anatomy-of-an-http-transaction rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Anatomy of an HTTP Transaction</span></div></a><li><a href=/learn/http/enterprise-network-configuration rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Enterprise Network Configuration</span></div></a></ul></section><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>Manipulating Files</label><ul class=sRlY2a_itemList><li><a href=/learn/manipulating-files/nodejs-file-stats rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Node.js file stats</span></div></a><li><a href=/learn/manipulating-files/nodejs-file-paths rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Node.js File Paths</span></div></a><li><a href=/learn/manipulating-files/reading-files-with-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Reading files with Node.js</span></div></a><li><a href=/learn/manipulating-files/writing-files-with-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Writing files with Node.js</span></div></a><li><a href=/learn/manipulating-files/working-with-file-descriptors-in-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Working with file descriptors in Node.js</span></div></a><li><a href=/learn/manipulating-files/working-with-folders-in-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Working with folders in Node.js</span></div></a><li><a href=/learn/manipulating-files/working-with-different-filesystems rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>How to work with Different Filesystems</span></div></a></ul></section><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>Asynchronous Work</label><ul class=sRlY2a_itemList><li><a href=/learn/asynchronous-work/javascript-asynchronous-programming-and-callbacks rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>JavaScript Asynchronous Programming and Callbacks</span></div></a><li><a href=/learn/asynchronous-work/asynchronous-flow-control rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Asynchronous flow control</span></div></a><li><a href=/learn/asynchronous-work/discover-promises-in-nodejs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Discover Promises in Node.js</span></div></a><li><a href=/learn/asynchronous-work/discover-javascript-timers rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Discover JavaScript Timers</span></div></a><li><a href=/learn/asynchronous-work/overview-of-blocking-vs-non-blocking rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Overview of Blocking vs Non-Blocking</span></div></a><li><a href=/learn/asynchronous-work/event-loop-timers-and-nexttick rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>The Node.js Event Loop</span></div></a><li><a href=/learn/asynchronous-work/the-nodejs-event-emitter rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>The Node.js Event Emitter</span></div></a><li><a href=/learn/asynchronous-work/understanding-processnexttick rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Understanding process.nextTick()</span></div></a><li><a href=/learn/asynchronous-work/understanding-setimmediate rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Understanding setImmediate()</span></div></a><li><a href=/learn/asynchronous-work/dont-block-the-event-loop rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Don't Block the Event Loop</span></div></a></ul></section><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>TypeScript</label><ul class=sRlY2a_itemList><li><a href=/learn/typescript/introduction rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Introduction to TypeScript</span></div></a><li><a href=/learn/typescript/run-natively rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Running TypeScript Natively</span></div></a><li><a href=/learn/typescript/transpile rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Running TypeScript code using transpilation</span></div></a><li><a href=/learn/typescript/run rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Running TypeScript with a runner</span></div></a><li><a href=/learn/typescript/publishing-a-ts-package rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Publishing a TypeScript package</span></div></a></ul></section><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>Modules</label><ul class=sRlY2a_itemList><li><a href=/learn/modules/how-to-use-streams rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>How to use streams</span></div></a><li><a href=/learn/modules/backpressuring-in-streams rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Backpressuring in Streams</span></div></a><li><a href=/learn/modules/publishing-a-package rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Publishing a package</span></div></a><li><a href=/learn/modules/publishing-node-api-modules rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>How to publish a Node-API package</span></div></a><li><a href=/learn/modules/abi-stability rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>ABI Stability</span></div></a></ul></section><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>Diagnostics</label><ul class=sRlY2a_itemList><li><a href=/learn/diagnostics/user-journey rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>User Journey</span></div></a><li><a href=/learn/diagnostics/memory rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Memory</span></div></a><li><a href=/learn/diagnostics/live-debugging rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Live Debugging</span></div></a><li><a href=/learn/diagnostics/poor-performance rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Poor Performance</span></div></a><li><a href=/learn/diagnostics/flame-graphs rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Flame Graphs</span></div></a></ul></section><section class="_3ChhEq_navigation sRlY2a_group"><label class=sRlY2a_groupName>Test Runner</label><ul class=sRlY2a_itemList><li><a href=/learn/test-runner/introduction rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Discovering Node.js's test runner</span></div></a><li><a href=/learn/test-runner/using-test-runner rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Using Node.js's test runner</span></div></a><li><a href=/learn/test-runner/mocking rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Mocking in tests</span></div></a><li><a href=/learn/test-runner/collecting-code-coverage rel=prefetch class=UNVuiW_item><div class=UNVuiW_label><span>Collecting code coverage in Node.js</span></div></a></ul></section></aside><div><div><details class=xdcBXG_details><summary class=xdcBXG_summary><svg fill=none viewBox="0 0 24 24" stroke-width=1.5 stroke=currentColor aria-hidden=true data-slot=icon class=xdcBXG_icon><path stroke-linecap=round stroke-linejoin=round d="m8.25 4.5 7.5 7.5-7.5 7.5"/></svg> On this page</summary><ul class=xdcBXG_list><li><a href=#my-process-runs-out-of-memory class=xdcBXG_link>My process runs out of memory</a><li><a href=#symptoms class="xdcBXG_depthThree xdcBXG_link">Symptoms</a><li><a href=#side-effects class="xdcBXG_depthThree xdcBXG_link">Side Effects</a><li><a href=#my-process-utilizes-memory-inefficiently class=xdcBXG_link>My process utilizes memory inefficiently</a><li><a href=#symptoms-1 class="xdcBXG_depthThree xdcBXG_link">Symptoms</a><li><a href=#side-effects-1 class="xdcBXG_depthThree xdcBXG_link">Side Effects</a><li><a href=#debugging class=xdcBXG_link>Debugging</a></ul></details><br><main><div><h1 id=memory><a href=#memory class=anchor>Memory</a></h1></div> |
| <p>In this document you can learn about how to debug memory related issues.<div><h2 id=my-process-runs-out-of-memory><a href=#my-process-runs-out-of-memory class=anchor>My process runs out of memory</a></h2></div> |
| <p>Node.js <em>(JavaScript)</em> is a garbage collected language, so having memory |
| leaks is possible through retainers. As Node.js applications are usually |
| multi-tenant, business critical, and long-running, providing an accessible and |
| efficient way of finding a memory leak is essential.</p> |
| <p>You can also fine-tune memory to get specific results. Check out |
| <a href=/learn/diagnostics/memory/understanding-and-tuning-memory>Understanding and Tuning Memory</a> for more details.<div><h3 id=symptoms><a href=#symptoms class=anchor>Symptoms</a></h3></div> |
| <p>The user observes continuously increasing memory usage <em>(can be fast or slow, |
| over days or even weeks)</em> then sees the process crashing and restarting by the |
| process manager. The process is maybe running slower than before and the |
| restarts cause some requests to fail <em>(load balancer responds with 502)</em>.<div><h3 id=side-effects><a href=#side-effects class=anchor>Side Effects</a></h3></div> |
| <ul> |
| <li>Process restarts due to the memory exhaustion and requests are dropped |
| on the floor</li> |
| <li>Increased GC activity leads to higher CPU usage and slower response time |
| <ul> |
| <li>GC blocking the Event Loop causing slowness</li> |
| </ul> |
| </li> |
| <li>Increased memory swapping slows down the process (GC activity)</li> |
| <li>May not have enough available memory to get a Heap Snapshot</li> |
| </ul><div><h2 id=my-process-utilizes-memory-inefficiently><a href=#my-process-utilizes-memory-inefficiently class=anchor>My process utilizes memory inefficiently</a></h2></div><div><h3 id=symptoms-1><a href=#symptoms-1 class=anchor>Symptoms</a></h3></div> |
| <p>The application uses an unexpected amount of memory and/or we observe elevated |
| garbage collector activity.<div><h3 id=side-effects-1><a href=#side-effects-1 class=anchor>Side Effects</a></h3></div> |
| <ul> |
| <li>An elevated number of page faults</li> |
| <li>Higher GC activity and CPU usage</li> |
| </ul><div><h2 id=debugging><a href=#debugging class=anchor>Debugging</a></h2></div> |
| <p>Most memory issues can be solved by determining how much space our specific |
| type of objects take and what variables are preventing them from being garbage |
| collected. It can also help to know the allocation pattern of our program over |
| time.</p> |
| <ul> |
| <li><a href=/learn/diagnostics/memory/using-heap-profiler/>Using Heap Profiler</a></li> |
| <li><a href=/learn/diagnostics/memory/using-heap-snapshot/>Using Heap Snapshot</a></li> |
| <li><a href=/learn/diagnostics/memory/using-gc-traces/>GC Traces</a></li> |
| </ul></main></div><aside class=eaXTXq_wrapper><dl><dt>Reading Time<dd>2 min read<dt>Contribute<dd><svg width=20 height=20 viewBox="0 0 20 20" fill=currentColor class="dark:fill-neutral-100 fill-neutral-700"><path d="M10 1.25C5.16562 1.25 1.25 5.16562 1.25 10C1.25 13.8719 3.75469 17.1422 7.23281 18.3016C7.67031 18.3781 7.83437 18.1156 7.83437 17.8859C7.83437 17.6781 7.82344 16.9891 7.82344 16.2563C5.625 16.6609 5.05625 15.7203 4.88125 15.2281C4.78281 14.9766 4.35625 14.2 3.98438 13.9922C3.67812 13.8281 3.24063 13.4234 3.97344 13.4125C4.6625 13.4016 5.15469 14.0469 5.31875 14.3094C6.10625 15.6328 7.36406 15.2609 7.86719 15.0312C7.94375 14.4625 8.17344 14.0797 8.425 13.8609C6.47813 13.6422 4.44375 12.8875 4.44375 9.54062C4.44375 8.58906 4.78281 7.80156 5.34062 7.18906C5.25313 6.97031 4.94687 6.07344 5.42812 4.87031C5.42812 4.87031 6.16094 4.64063 7.83437 5.76719C8.53438 5.57031 9.27813 5.47187 10.0219 5.47187C10.7656 5.47187 11.5094 5.57031 12.2094 5.76719C13.8828 4.62969 14.6156 4.87031 14.6156 4.87031C15.0969 6.07344 14.7906 6.97031 14.7031 7.18906C15.2609 7.80156 15.6 8.57812 15.6 9.54062C15.6 12.8984 13.5547 13.6422 11.6078 13.8609C11.925 14.1344 12.1984 14.6594 12.1984 15.4797C12.1984 16.65 12.1875 17.5906 12.1875 17.8859C12.1875 18.1156 12.3516 18.3891 12.7891 18.3016C14.5261 17.7152 16.0355 16.5988 17.1048 15.1096C18.1741 13.6204 18.7495 11.8333 18.75 10C18.75 5.16562 14.8344 1.25 10 1.25Z"/></svg><a href=https://github.com/nodejs/learn/edit/main/pages/diagnostics/memory/index.md>Edit this page</a><dt>Table of Contents<dd><ol><li><a href=#my-process-runs-out-of-memory>My process runs out of memory</a><li class=pl-2><a href=#symptoms>Symptoms</a><li class=pl-2><a href=#side-effects>Side Effects</a><li><a href=#my-process-utilizes-memory-inefficiently>My process utilizes memory inefficiently</a><li class=pl-2><a href=#symptoms-1>Symptoms</a><li class=pl-2><a href=#side-effects-1>Side Effects</a><li><a href=#debugging>Debugging</a></ol></dl></aside></div></div><footer class=BbNFNW_container><div class=BbNFNW_innerContainer><div class=BbNFNW_row><div class=BbNFNW_sectionPrimary></div><div class=BbNFNW_sectionSecondary><div class=BbNFNW_social><a href=https://github.com/nodejs/node class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label><svg width=20 height=20 viewBox="0 0 20 20" fill=currentColor aria-label=https://github.com/nodejs/node><path d="M10 1.25C5.16562 1.25 1.25 5.16562 1.25 10C1.25 13.8719 3.75469 17.1422 7.23281 18.3016C7.67031 18.3781 7.83437 18.1156 7.83437 17.8859C7.83437 17.6781 7.82344 16.9891 7.82344 16.2563C5.625 16.6609 5.05625 15.7203 4.88125 15.2281C4.78281 14.9766 4.35625 14.2 3.98438 13.9922C3.67812 13.8281 3.24063 13.4234 3.97344 13.4125C4.6625 13.4016 5.15469 14.0469 5.31875 14.3094C6.10625 15.6328 7.36406 15.2609 7.86719 15.0312C7.94375 14.4625 8.17344 14.0797 8.425 13.8609C6.47813 13.6422 4.44375 12.8875 4.44375 9.54062C4.44375 8.58906 4.78281 7.80156 5.34062 7.18906C5.25313 6.97031 4.94687 6.07344 5.42812 4.87031C5.42812 4.87031 6.16094 4.64063 7.83437 5.76719C8.53438 5.57031 9.27813 5.47187 10.0219 5.47187C10.7656 5.47187 11.5094 5.57031 12.2094 5.76719C13.8828 4.62969 14.6156 4.87031 14.6156 4.87031C15.0969 6.07344 14.7906 6.97031 14.7031 7.18906C15.2609 7.80156 15.6 8.57812 15.6 9.54062C15.6 12.8984 13.5547 13.6422 11.6078 13.8609C11.925 14.1344 12.1984 14.6594 12.1984 15.4797C12.1984 16.65 12.1875 17.5906 12.1875 17.8859C12.1875 18.1156 12.3516 18.3891 12.7891 18.3016C14.5261 17.7152 16.0355 16.5988 17.1048 15.1096C18.1741 13.6204 18.7495 11.8333 18.75 10C18.75 5.16562 14.8344 1.25 10 1.25Z"/></svg></span></a><a href=https://discord.gg/nodejs class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label><svg width=20 height=20 viewBox="0 -28.5 256 256" fill=none aria-label=https://discord.gg/nodejs><path d="M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z" fill=#5865F2 fill-rule=nonzero /></svg></span></a><a href=https://social.lfx.dev/@nodejs class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label><svg width=20 height=20 viewBox="0 0 75 79" fill=none aria-label=https://social.lfx.dev/@nodejs><path d="M73.8393 17.4898C72.6973 9.00165 65.2994 2.31235 56.5296 1.01614C55.05 0.797115 49.4441 0 36.4582 0H36.3612C23.3717 0 20.585 0.797115 19.1054 1.01614C10.5798 2.27644 2.79399 8.28712 0.904997 16.8758C-0.00358524 21.1056 -0.100549 25.7949 0.0682394 30.0965C0.308852 36.2651 0.355538 42.423 0.91577 48.5665C1.30307 52.6474 1.97872 56.6957 2.93763 60.6812C4.73325 68.042 12.0019 74.1676 19.1233 76.6666C26.7478 79.2728 34.9474 79.7055 42.8039 77.9162C43.6682 77.7151 44.5217 77.4817 45.3645 77.216C47.275 76.6092 49.5123 75.9305 51.1571 74.7385C51.1797 74.7217 51.1982 74.7001 51.2112 74.6753C51.2243 74.6504 51.2316 74.6229 51.2325 74.5948V68.6416C51.2321 68.6154 51.2259 68.5896 51.2142 68.5661C51.2025 68.5426 51.1858 68.522 51.1651 68.5058C51.1444 68.4896 51.1204 68.4783 51.0948 68.4726C51.0692 68.4669 51.0426 68.467 51.0171 68.4729C45.9835 69.675 40.8254 70.2777 35.6502 70.2682C26.7439 70.2682 24.3486 66.042 23.6626 64.2826C23.1113 62.762 22.7612 61.1759 22.6212 59.5646C22.6197 59.5375 22.6247 59.5105 22.6357 59.4857C22.6466 59.4609 22.6633 59.4391 22.6843 59.422C22.7053 59.4048 22.73 59.3929 22.7565 59.3871C22.783 59.3813 22.8104 59.3818 22.8367 59.3886C27.7864 60.5826 32.8604 61.1853 37.9522 61.1839C39.1768 61.1839 40.3978 61.1839 41.6224 61.1516C46.7435 61.008 52.1411 60.7459 57.1796 59.7621C57.3053 59.7369 57.431 59.7154 57.5387 59.6831C65.4861 58.157 73.0493 53.3672 73.8178 41.2381C73.8465 40.7606 73.9184 36.2364 73.9184 35.7409C73.9219 34.0569 74.4606 23.7949 73.8393 17.4898Z" fill=url(#paint0_linear_549_34) /><path d="M61.2484 27.0263V48.114H52.8916V27.6475C52.8916 23.3388 51.096 21.1413 47.4437 21.1413C43.4287 21.1413 41.4177 23.7409 41.4177 28.8755V40.0782H33.1111V28.8755C33.1111 23.7409 31.0965 21.1413 27.0815 21.1413C23.4507 21.1413 21.6371 23.3388 21.6371 27.6475V48.114H13.2839V27.0263C13.2839 22.7176 14.384 19.2946 16.5843 16.7572C18.8539 14.2258 21.8311 12.926 25.5264 12.926C29.8036 12.926 33.0357 14.5705 35.1905 17.8559L37.2698 21.346L39.3527 17.8559C41.5074 14.5705 44.7395 12.926 49.0095 12.926C52.7013 12.926 55.6784 14.2258 57.9553 16.7572C60.1531 19.2922 61.2508 22.7152 61.2484 27.0263Z" fill=white /><defs><linearGradient id=paint0_linear_549_34 x1=37.0692 y1=0 x2=37.0692 y2=79 gradientUnits=userSpaceOnUse><stop stop-color=#6364FF /><stop offset=1 stop-color=#563ACC /></linearGradient></defs></svg></span></a><a href=https://bsky.app/profile/nodejs.org class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label><svg width=20 height=20 viewBox="0 0 568 501" fill=none aria-label=https://bsky.app/profile/nodejs.org><path fill=#1185FE d="M123.121 33.664C188.241 82.553 258.281 181.68 284 234.873c25.719-53.192 95.759-152.32 160.879-201.21C491.866-1.611 568-28.906 568 57.947c0 17.346-9.945 145.713-15.778 166.555-20.275 72.453-94.155 90.933-159.875 79.748C507.222 323.8 536.444 388.56 473.333 453.32c-119.86 122.992-172.272-30.859-185.702-70.281-2.462-7.227-3.614-10.608-3.631-7.733-.017-2.875-1.169.506-3.631 7.733-13.43 39.422-65.842 193.273-185.702 70.281-63.111-64.76-33.89-129.52 80.986-149.071-65.72 11.185-139.6-7.295-159.875-79.748C9.945 203.659 0 75.291 0 57.946 0-28.906 76.135-1.612 123.121 33.664Z"/></svg></span></a><a href=https://twitter.com/nodejs class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label><svg width=20 height=20 viewBox="0 0 24 24" fill=currentColor aria-label=https://twitter.com/nodejs><path d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"/></svg></span></a><a href=https://slack-invite.openjsf.org/ class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label><svg width=20 height=20 viewBox="0 0 20 20" fill=none aria-label=https://slack-invite.openjsf.org/><path fill=#2EB67D d="M16.563 9.375A1.562 1.562 0 1 0 15 7.813v1.562h1.563Zm-4.375 0c.862 0 1.562-.7 1.562-1.563V3.438a1.563 1.563 0 0 0-3.125 0v4.374c0 .863.7 1.563 1.563 1.563Z"/><path fill=#E01E5A d="M3.437 10.625A1.562 1.562 0 1 0 5 12.187v-1.562H3.437Zm4.376 0c-.863 0-1.563.7-1.563 1.563v4.374a1.563 1.563 0 0 0 3.125 0v-4.374c0-.863-.7-1.563-1.563-1.563Z"/><path fill=#ECB22E d="M10.625 16.563A1.562 1.562 0 1 0 12.187 15h-1.562v1.563Zm0-4.375c0 .862.7 1.562 1.563 1.562h4.374a1.562 1.562 0 1 0 0-3.125h-4.374c-.863 0-1.563.7-1.563 1.563Z"/><path fill=#36C5F0 d="M9.375 3.437A1.562 1.562 0 1 0 7.813 5h1.562V3.437Zm0 4.376c0-.863-.7-1.563-1.563-1.563H3.438a1.563 1.563 0 0 0 0 3.125h4.374c.863 0 1.563-.7 1.563-1.563Z"/></svg></span></a><a href=https://www.linkedin.com/company/node-js class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label><svg width=20 height=20 viewBox="0 0 24 24" fill=currentColor aria-label=https://www.linkedin.com/company/node-js><path d="M20.5 2h-17A1.5 1.5 0 002 3.5v17A1.5 1.5 0 003.5 22h17a1.5 1.5 0 001.5-1.5v-17A1.5 1.5 0 0020.5 2zM8 19H5v-9h3zM6.5 8.25A1.75 1.75 0 118.3 6.5a1.78 1.78 0 01-1.8 1.75zM19 19h-3v-4.74c0-1.42-.6-1.93-1.38-1.93A1.74 1.74 0 0013 14.19a.66.66 0 000 .14V19h-3v-9h2.9v1.3a3.11 3.11 0 012.7-1.4c1.55 0 3.36.86 3.36 3.66z"/></svg></span></a></div></div></div><div class="BbNFNW_legal BbNFNW_row"><p>Copyright <a href=https://openjsf.org/>OpenJS Foundation</a> and Node.js contributors. All rights reserved. The <a href=https://openjsf.org/>OpenJS Foundation</a> has registered trademarks and uses trademarks. For a list of trademarks of the <a href=https://openjsf.org/>OpenJS Foundation</a>, please see our <a href=https://trademark-policy.openjsf.org/>Trademark Policy</a> and <a href=https://trademark-list.openjsf.org/>Trademark List</a>. Trademarks and logos not indicated on the <a href=https://trademark-list.openjsf.org/>list of OpenJS Foundation trademarks</a> are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.<p><a href=https://openjsf.org/ class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>OpenJS Foundation</span></a><a href=https://terms-of-use.openjsf.org/ class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>Terms of Use</span></a><a href=https://privacy-policy.openjsf.org/ class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>Privacy Policy</span></a><a href=https://bylaws.openjsf.org/ class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>Bylaws</span></a><a href=https://github.com/openjs-foundation/cross-project-council/blob/main/CODE_OF_CONDUCT.md class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>Code of Conduct</span></a><a href=https://trademark-policy.openjsf.org/ class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>Trademark Policy</span></a><a href=https://trademark-list.openjsf.org/ class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>Trademark List</span></a><a href=https://www.linuxfoundation.org/cookies/ class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>Cookie Policy</span></a><a href=https://github.com/nodejs/node/security/policy class="J9yHBG_footer J9yHBG_navItem"><span class=J9yHBG_label>Security Policy</span></a></div></div></footer></div> |
| <script type=module src=https://nodejs.org/learn/diagnostics-memoryindex.js?a6b538ae-f7d8-444e-bda2-3b8c41de1139></script> |