Study from open source code -- malloc trace (1)

本文介绍了一种通过自定义malloc_hook来跟踪和调试程序中内存分配的方法。通过重写malloc、realloc和free函数的钩子,可以在运行时打印出每次内存分配和释放的详细信息,有助于发现内存泄漏等问题。

for working on fsck the disk mounted on board, i read the the code of the e2fsck, study some useful skills, such like this:

 

malloc_trace.

 

we malloc or free the memory in programes, some skills will be useful for us to debug

 

if want get more information, please 'man malloc_hook'

 

a example follw:

 

 

ref_info.Nsamples is 968546369------------------------ -----------------ref_info.Nsamples is 0------------------------ ------pesq_measure-------------- ref_info->Nsamples is 0 -------------------- Reading reference file /eap/voip通话质量/pesq/pesq_source_2/voice/30s_rtp_cai123.wav...---malloc 10--- --------max_size is 1002308---------- ---malloc 11---size is 1002308---malloc 12---size is 31002 and 31002------load_src-------------- ref_info->Nsamples is 248017 -------------------- done. Reading degraded file /eap/voip通话质量/pesq/pesq_source_2/voice/output.wav...---malloc 10--- --------max_size is 1226236---------- ---malloc 11---size is 1226236---malloc 12---size is 37999 and 37999done. ====ref_info->Nsamples is 248017 ref_info.Nsamples is 248017 ---malloc 13---size is 1226236 Level normalization... -------------------- ref_info->Nsamples is 248017 -----fix_power_level and info-> Nsamples is 248017 ---malloc 1---size is 1002308 there is fix_power_level on apply_filter malloc 20 size is 1048584,maxNsamples is 248017 and n is 245777 malloc 20 maxNsamples is 248017,Downsample is 32 and Fs is 8000,pow_of_2 is 262144 --------max_size is 2097152---------- -----fix_power_level and info-> Nsamples is 303999 ---malloc 1---size is 1226236 there is fix_power_level on apply_filter --------max_size is 2097160---------- malloc 20 size is 2097160,maxNsamples is 303999 and n is 301759 malloc 20 maxNsamples is 303999,Downsample is 32 and Fs is 8000,pow_of_2 is 524288 --------max_size is 4194304---------- IRS filtering... malloc 20 size is 1048584,maxNsamples is 248017 and n is 245777 malloc 20 maxNsamples is 248017,Downsample is 32 and Fs is 8000,pow_of_2 is 262144 malloc 20 size is 2097160,maxNsamples is 303999 and n is 301759 malloc 20 maxNsamples is 303999,Downsample is 32 and Fs is 8000,pow_of_2 is 524288 ---malloc 2---size is 1226236 Variable delay compensation... ---malloc 3---size is 1226236 Acoustic model processing... ---malloc 15------malloc 16------malloc 17------malloc 14---size is 32776 ---malloc 17------malloc 14---size is 32776 ---malloc 17------malloc 14---size is 32776 ---malloc 17------malloc 14---size is 32776 ---malloc 17------malloc 14---size is 32776 ---malloc 17------malloc 14---size is 32776 ---malloc 18--- -------------------------------------------------------------- ---------------Prediction : PESQ_MOS = 2.594----------------- -------------------------------------------------------------
10-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值