`
netcome
  • 浏览: 482431 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Tracking AllMemory Allocation and Free Calls

阅读更多

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.

 

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics