如何检测内存泄漏

  • 不断检查可用的交换空间
    /usr/sbin/swap -s
  • 不断检查进程使用的内存页面数量
    ps -lu

书中提到的这两种办法属于动态监测程序是否存在内存泄漏,在实际工作中,我们可以借助一些静态代码检测工具来检测可能的内存泄漏。

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google+ photo

You are commenting using your Google+ account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.