Spec-Zone .ru
спецификации, руководства, описания, API
Spec-Zone .ru
спецификации, руководства, описания, API
Библиотека разработчика Mac Разработчик
Поиск

 

Эта страница руководства для  версии 10.9 Mac OS X

Если Вы выполняете различную версию  Mac OS X, просматриваете документацию локально:

Читать страницы руководства

Страницы руководства предназначаются как справочник для людей, уже понимающих технологию.

  • Чтобы изучить, как руководство организовано или узнать о синтаксисе команды, прочитайте страницу руководства для страниц справочника (5).

  • Для получения дополнительной информации об этой технологии, ищите другую документацию в Библиотеке Разработчика Apple.

  • Для получения общей информации о записи сценариев оболочки, считайте Shell, Пишущий сценарий Учебника для начинающих.




leaks(1)                  BSD General Commands Manual                 leaks(1)

NAME
     leaks -- Search a process's memory for unreferenced malloc buffers

SYNOPSIS
     leaks pid | partial-executable-name [-nocontext] [-nostacks] [-exclude symbol] [-trace address]

DESCRIPTION
     leaks identifies leaked memory -- memory that the application has allocated, but has been lost and can-not cannot
     not be freed.  Specifically, leaks examines a specified process's memory for values that may be point-ers pointers
     ers to malloc-allocated buffers.  Any buffer reachable from a pointer in writable global memory (e.g.,
     __DATA segments), a register, or on the stack is assumed to be memory in use.  Any buffer reachable
     from a pointer in a reachable malloc-allocated buffer is also assumed to be in use.  The buffers which
     are not reachable are leaks; the buffers could never be freed because no pointer exists in memory to
     the buffer, and thus free() could never be called for these buffers.  Such buffers waste memory; remov-ing removing
     ing them can reduce swapping and memory usage.  Leaks are particularly dangerous for long-running pro-grams, programs,
     grams, for eventually the leaks could fill memory and cause the application to crash.

     leaks requires one parameter -- either the process ID or executable name of the process to examine.  It
     also takes several arguments for modifying its behavior.

     For each leaked buffer that is found, leaks prints the address of the leaked memory and its size.  If
     leaks can determine that the object is an instance of an Objective-C, CoreFoundation, or C++ class, or
     a CFType, it also specifies the name and type of the class, and the binary image that implements the
     class.  It then prints a string or hexadecimal representation of the contents of the memory, unless the
     -nocontext option was specified.

     If the MallocStackLogging environment variable was set when the application was launched, leaks also
     prints a stack trace describing where the buffer was allocated.

OPTIONS
     -nocontext     Do not print the string or hex representation of leaked memory.  Although that informa-tion information
                    tion can be useful for recognizing the contents of the buffer and understanding why it
                    might be leaked, it can also provide overwhelming detail, and could expose confidential
                    information from your process if you, for example, file bug reports with that output
                    included.

     -nostacks      Do not print backtraces of leaked blocks even if the target process has the MallocStack-Logging MallocStackLogging
                    Logging environment variable set.

     -exclude symbol
                    Exclude leaked blocks whose backtraces include the specified symbol.  This option can be
                    repeated for multiple symbols.  This allows ignoring leaks that, for example, are allo-cated allocated
                    cated in libraries for which you do not have source code.

     -trace address
                    Print chains of references from process 'roots' (e.g., global data, registers, or loca-tions locations
                    tions on stacks) to the given block.  This is useful for determining what is holding
                    onto a buffer such that it has not been freed.

ENVIRONMENT
     The leaks command may detect more leaks if the target process is run with the MallocScribble environ-ment environment
     ment variable.  If this variable is set then when malloc blocks are deallocated they are filled with
     0x55 bytes, thus overwriting any "stale" data such as pointers remaining in those blocks.  This reduces
     the number of false pointers remaining in the process memory.

EXIT STATUS
     The leaks command exits with one of the following values:

     0     No leaks were detected.
     1     One or more leaks were detected.
     >1    An error occurred.

SEE ALSO
     malloc(3), heap(1), malloc_history(1), stringdups(1), vmmap(1), DevToolsSecurity(1)

     The Xcode developer tools also include Instruments, a graphical application that can give information
     similar to that provided by leaks. The Allocations instrument graphically displays dynamic, real-time
     information about the object and memory use in an application, including backtraces of where the allo-cations allocations
     cations occurred.  The Leaks instrument performs memory leak analysis.

BSD                              Mar. 16, 2013                             BSD

Сообщение о проблемах

Способ сообщить о проблеме с этой страницей руководства зависит от типа проблемы:

Ошибки содержания
Ошибки отчета в содержании этой документации со ссылками на отзыв ниже.
Отчеты об ошибках
Сообщите об ошибках в функциональности описанного инструмента или API через Генератор отчетов Ошибки.
Форматирование проблем
Отчет, форматирующий ошибки в интерактивной версии этих страниц со ссылками на отзыв ниже.