内容简介: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.
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.
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.
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/
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
你也能看得懂的Python算法书
王硕,董文馨,张舒行,张洁 著 / 电子工业出版社 / 2018-11-1 / 59.00
编程的核心是算法,学习算法不仅能教会你解决问题的方法,而且还能为你今后的发展提供一种可能。 《你也能看得懂的Python算法书》面向算法初学者,首先介绍当下流程的编程语言Python,详细讲解Python语言中的变量和循序、分支、循环三大结构,以及列表和函数的使用,为之后学习算法打好基础。然后以通俗易懂的语言讲解双指针、哈希、深度优先、广度优先、回溯、贪心、动态规划和至短路径等经典算法。 ......一起来看看 《你也能看得懂的Python算法书》 这本书的介绍吧!