ANALYZEALLOCATION(1)ANALYZEALLOCATION(1)NAMEAnalyzeAllocation - analyze memory allocation statistics.
SYNOPSISAnalyzeAllocation [-help] [-v] file
DESCRIPTIONAnalyzeAllocation analyzes the allocation statistics gathered by the
Foundation Framework (see NSDebug.h). To gather all allocation
statistics, you can set NSKeepAllocationStatistics to YES in your
environment and then run the application. This records allocation
statistics in a file named /tmp/alloc_stats_application_pid. This file
gets very large very quickly, in addition to making your program run
much more slowly, so it's important not to run too much of your program
with the NSKeepAllocationStatistics environment variable turned on.
Instead, run a specific task, then turn the environment variable off.
As an alternative, you can control what portions of the running
application are measured by setting the global variable
NSKeepAllocationStatistics to YES when you want to gather statistics
and NO when you do not. This variable is defined in the Foundation
Framework file NSDebug.h.
After you have gathered statistics, you run the AnalyzeAllocation
command to analyze them. AnalyzeAllocation with no options prints a
table that summarizes the allocation statistics. For each class, the
table provides the following information:
retain Invocations of the default retain implementation
release
Invocations of the default release implementation
iretain
Invocations of an override of retain
irelease
Invocations of an override of release
autorelease
Invocations of autorelease
copy Invocations of copy
instances
Number of instances still alive
max Maximum number of instances at one time
total Total number of instances created
class Name of the class
The -v option prints a detailed analysis for each class, consisting of:
The number of objects allocated
The number of objects deallocated
Shortest lifetime (in seconds) of any object of this class
Median lifetime (in seconds) of any object of this class
Maximum lifetime (in seconds) of any object of this class
Number of ephemeral objects, objects that lasted less than 0.01
seconds
Minimum number of retains on any object of this class
Median number of retains on all objects of this class
Maximum number of retains on any object of this class
Minimum number of releases on any object of this class
Median number of releases on all objects of this class
Maximum number of releases on any object of this class
Minimum number of invocations of an override of retain for any
object of this class
Median number of invocations of an override of retain on all
objects
Maximum number of invocations of an override of retain on any
object
Minimum number of invocations of an override of release on any
object
Median number of invocations of an override of release on all
objects
Maximum number of invocations of an override of release on any
object
Minimum number of autoreleases on any object
Median number of autoreleases on all objects
Maximum number of autoreleases on any object
Minimum number of copies on any object
Median number of copies on all objects
Maximum number of copies on any object
Minimum number of retains on any instance of this class
Median number of retains on all objects
Maximum number of retains on any object
OPTIONS-help Displays a message describing how to use AnalyzeAllocation.
-v Displays a different set of statistics as described above.
file The file to be analyzed. Its name has the form
/tmp/alloc_stats_appName_pid
EXAMPLES
# setenv NSKeepAllocationStatistics YES
# /NextDeveloper/Demos/TextEdit.app/TextEdit
run for a while, then quit
# unsetenv NSKeepAllocationStatistics
# AnalyzeAllocation-v /tmp/alloc_stats_Edit_*
NeXT Software, Inc. March 28, 1996 ANALYZEALLOCATION(1)