Memory Management and Leak Visualizations

栏目: IT技术 · 发布时间: 4年前

内容简介:What are memory leaks?No matter what programming language you code in the lifecycle of memory management is pretty much the same.While this may seem pretty straightforward memory doesn’t always get released. In a simple app this is not a huge issue but in

What are memory leaks?

No matter what programming language you code in the lifecycle of memory management is pretty much the same.

While this may seem pretty straightforward memory doesn’t always get released. In a simple app this is not a huge issue but in larger applications this can pile up and lead to the codebase experiencing a serious memory leak and the application may end up not working properly. While at the beginning you might just see slow performance, in the long term if unaddressed the leak can lead to bigger issues and crashes. In short, a memory leak is data that may not be garbage collected and is not put to use.

Chrome developer tools have a handy option for taking heap snapshots but the information is hard to decipher.

Memory Management and Leak Visualizations

While we loved the v8 engine data we felt that there was a visual aspect that was missing. You could only view it from the Chrome dev tools memory tab. We used node-heapdump to get the information out of the browser and into our app. We also used WebSockets to send and receive data in real-time through a duplex stream between aether’s server and the client it’s installed on. WebSockets allow for a higher amount of efficiency compared to REST because they do not require the HTTP request/response overhead for each message sent and received.

The heap snapshot data that was coming back was initially overwhelming to look at and hard to make sense of. So in order to help us write better code and debug our codebases we parsed through the snapshots and developed a tool that would help us see at a glance the size of nodes and overall memory usage.

Memory Management and Leak Visualizations

This chart shows the self size of the nodes in an application.

Self size — The size of the memory contained by the node itself. Very large objects will have large self sizes, like long strings, dictionaries, and functions with large bodies.

Retained size — The object’s self size plus the sizes of all of the objects that would be freed should the object be deleted.

Memory Management and Leak Visualizations

This chart shows an example of spikes in memory usage in your application.

If you’re interested in trying it for yourself here is a link to the tool! https://github.com/oslabs-beta/aether/


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

五子连珠必胜法

五子连珠必胜法

新井华石 / 张书 / 人民体育出版社 / 1997-10 / 12.00元

《五子连珠必胜法》经日本国虹有社授权,译自日本连珠社已故理事长新井华石九段经典著作《连珠必胜法》一书。内容阐述和介绍五子连珠的基本着法和各种常用的布局定式。全书分两大编。连珠基本编介绍连珠棋的发展历史、连珠棋的规则和规定以及基本珠形。连珠必胜编分为六章分别阐述和介绍各种常用布局定式,包括二号连浦月、五号连花月、一号连云月、二号桂名月、三号桂岚月、二号间恒星六种布局定式。一起来看看 《五子连珠必胜法》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具