[英]Perl script strange behavior / Reclaim memory
My script does the following 我的脚本执行以下操作
Then it waits for 10+ minutes after the last print statement and exits. 然后它在最后一个打印语句后等待10分钟以上并退出。 The wait at the end doesn't happen every time. 最后的等待不会每次都发生。 During the wait top
command shows the same 92% memory usage but no cpu usage. 在wait top
命令期间显示相同的92%内存使用量但没有cpu使用率。 Why does it wait sometimes after it is done ? 为什么它有时会在完成后等待? If I hit Ctrl C , it exits immediately without any change in outcome(results). 如果我按下Ctrl C ,它会立即退出而不会改变结果(结果)。 How do I debug this or is it expected behavior as the hash is huge ? 我如何调试这个或者它是预期的行为,因为哈希是巨大的?
EDIT 编辑
Is it possible to reclaim some memory on the fly by deleting unwanted key - value pairs from the hash ? 通过从哈希中删除不需要的键值对,可以动态回收一些内存吗?
I assume you know 'delete' function (so removed reference to perldoc -f delete :) 我假设你知道'删除'功能(所以删除了对perldoc -f delete的引用:)
For the memory debugging you could use valgrind Also this hint can be helpful: Does Perl v5.10.1 have memory leaks or how to interpret valgrind It suggests using: 对于内存调试,您可以使用valgrind此提示也很有帮助: Perl v5.10.1是否有内存泄漏或如何解释valgrind它建议使用:
use Perl::Destruct::Level level => 1; 使用Perl :: Destruct :: Level level => 1;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.