PTC MKS Toolkit Knowledge Base

Section:IO
Product:MKS Toolkit (TKPDev/TKEDev)
Version:
OS:All
Keywords:porting, insure, memory, analysis, testing, debug
Category:Porting/Knowledge Base


What do I need to know when using Purify with MKS Toolkit ported applications?


Purify is a run-time analysis tool from Rational Software, commonly used to detect memory access errors and memory leaks. It is available on both UNIX and Windows platforms. Purify for Windows works quite well with Toolkit for Enterprise Developers (formerly NuTCRACKER) ported applications.

One issue is that Purify cannot debug an application that calls fork(). Purify for Windows is not aware of the address-space replication that occurs with fork(), because this does not follow the normal Window process model. This causes Purify to treat the parent and child as two separate processes, and therefore the memory state of the child process is incorrect. As a result, this causes Purify to report many spurious access violation errors. More commonly, the Purify'd child will simply fail. There are no restrictions with vfork(), execXXX(), or _NutForkExecXXX().

Another issue is that Purify for Windows will report errors when instrumenting the file nutsh4.dll, which is the NuTCRACKER Platform SmartHeap library. SmartHeap isn't used when running under Purify (because it would conflict with Purify's memory allocator), but Purify will instrument it because the NuTCRACKER Platform system DLL is linked against it. Purify will attempt to re-instrument this file every time you run a ported application. You can prevent Purify from continually reporting these warnings by removing the file: NUTSH4$Purify_XXX.DLL.warnings from the CACHE directory under your Purify installation directory (XXX is an encoded form of the path name to the DLL; it will vary from system to system).

The final issue is that Purify reports many spurious warnings about ported applications. Toolkit for Enterprise Developers includes a set of custom filters to reduce the number of warnings that Purify produces when running ported applications. You can view these filters by enabling the Libraries setting on the View menu of the Purify filter manager, then looking at the filters associated with nutsys4.dll. You should not modify the NuTCRACKER-supplied filters, because any changes you make may be overwritten by a Toolkit update.

If you are familiar with Purify on UNIX platforms, you may be surprised by the number of Uninitialized Memory Read (UMR) errors reported by Purify for Windows. Current versions of Purify for Windows do not always handle operations on bitfields in structures correctly. This issues is listed in the Known Problems section of the Purify for Windows Readme.txt file. This problem occurs frequently in X Windows applications; many of the filters supplied with NuTCRACKER are to suppress incorrectly-reported UMR errors in X applications.