什么是挂钩的malloc的目的是什么? [英] What is the purpose of malloc hooks?

查看:162
本文介绍了什么是挂钩的malloc的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到底什么是使用malloc挂钩的目的是什么?我读过它在内存分析使用等,但从来没有真正理解如何。

What exactly is the purpose of using malloc hooks? And I've read it's used in memory-profiling, etc. but never really understood how.

推荐答案

好吧,如果你可以挂接到分配函数的行为,那么你就可以跟踪内存分配的分析和调试。

Well, if you can hook into the behaviour of allocation functions, then you can track memory allocations for profiling and debugging.

上的malloc挂钩GCC的文档具有一个可爱的小例如展示每次分配函数被调用时添加调试输出。

The GCC documentation on malloc hooks has a nice little example demonstrating adding debug output every time the allocation functions are invoked.

我真的不知道还有什么要告诉你......是不是足够的理由?

I'm not really sure what else to tell you... is that not reason enough?

这篇关于什么是挂钩的malloc的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆