Recent Articles



































Purify



         


See also purification for the sense of refining.

Purify is a memory debugger program used by software developers to detect memory access errors in programs, especially those written in C or C++. It is made by Rational Software. Purify does dynamic verification, i.e. it discovers errors that occur when the program runs, much like a debugger. Static verification or static code analysis, by contrast, involve detecting errors in the source code without ever compiling or running it, just by discovering logical inconsistencies. The type checking by a C compiler is an example of static verification.

When a program is compiled with Purify, correctness verification code is automatically inserted into the executable. That way, if a memory error, aka memory leak occurs, the program will print out the approximate location of the error, the memory address involved, and other relevant information. The errors that Purify discovers include array bounds reads and writes, trying to access unallocated memory, and freeing unallocated memory (usually due to freeing the same memory for the second time). It is essential to note that most of these errors are not fatal, and often when just running the program there is no way to detect them, except by observing that something is wrong due to incorrect program behavior. Hence Purify helps enormously by detecting these errors and telling the programmer exactly where they occur.

Ability to detect non-fatal errors are a major distinction of Purify and similar programs from the usual debuggers. By contrast, debuggers generally only allow the programmer to quickly find the sources of fatal errors, such as a program crash due to reading a null pointer, but do not help to detect the non-fatal memory errors. Debuggers are useful for other things that Purify is not intended for, such as for stepping through the code line by line or examining the program's memory by hand at a particular moment of execution. In other words, these tools can complement each other for a skilled developer. On the other hand, it should be noted that debugging with a debugger is essentially done by hand, much like coding itself, and many programmers may prefer to debug without it just by examining program output at various places. Purify, on the other hand, works automatically, save for the effort required to set it up so that it compiles with the code properly, and so most developers would probably avail themselves of the simplicity and power of the automatic verification of memory accesses it offers, at least if it available on their system.

It is notable that using Purify only makes sense in programming languages that leave memory management to the programmer. Hence, in Java, Lisp, or Visual Basic, for example, automatic memory management preclude occurrence of any memory leaks.

There exist open source or free equivalents of Purify. See also memory debugger for a list of alternatives to Purify.

Purify is proprietary and costs a lot to license for commercial purposes, although universities may obtain cheap academic licenses.

[Top]




  View Live Article   This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License