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/


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

查看所有标签

猜你喜欢:

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

产品增长力

产品增长力

李阳 / 机械工业出版社 / 2018-4-1 / 59

本书由京东资深数据产品经理撰写,重新定义了数据与产品、业务的关系,从数据分析方法、数据价值挖掘、数据结果倒逼业务优化3个层次,以及设计、运营和优化3个维度,为产品增长提供了科学的依据和方法论,得到了PMCaff创始人阿德、GrowingIO创始人&CEO张溪梦、增长官研究院创始人范冰、腾讯高级产品经理刘涵宇等专家的高度评价。 全书内容以理论为主线,以实操为目标,萃取技术实操与管理思维中的精华......一起来看看 《产品增长力》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试