Tracking AllMemory Allocation and Free Calls

本文介绍了常见的原生内存泄漏检测方法和技术工具,如Purify和Sun的dbxRunTimeChecking等,这些工具能帮助开发者定位内存泄漏问题,并提供了一些开源工具的获取途径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

3.4.1

 

A very common practice is to track all allocation and free calls of the native allocations. This can

be a fairly simple process or a very sophisticated one.Many products over the years have been

built up around the tracking of native heap allocations and the use of thatmemory.

Tools like Purify and Sun's dbx Run Time Checking (see “3.4.4Using dbx to Find Leaks” on

page 83) functionality can be used to ind these leaks in normal native code situations and also

ind any access to native heap memory that represents assignments to uninitializedmemory or

accesses to freedmemory.

最常见的办法是跟踪所有原生内存的分配和释放操作。Purify和Sun的dbx Run Time Checking可以用于跟踪。

 

Not all these types of tools will work with Java applications that use native code, and usually

these tools are platform-speciic. Since the virtualmachine dynamically creates code at runtime,

these tools can wrongly interpret the code and fail to run at all, or give false information. Check

with your tool vendor tomake sure the version of the tool works with the version of the virtual

machine you are using.

注意:确保使用的工具支持Java虚拟机版本。

 

Many simple and portable native memory leak detecting examples can be found at

http://sourceforge.net/.Most of these libraries and tools assume that you can recompile or

edit the source of the application and place wrapper functions over the allocation functions.

The more powerful of these tools allow you to run your application unchanged by interposing

over these allocation functions dynamically. This is the case with the library libumem.so,

starting with Solaris 9OS update 3; see “3.4.5Using libumem to Find Leaks” on page 85.

 

一些工具假设你能够重新编译或者编辑应用代码(这不是我们想要的)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值