Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Python tool for diagnosing memory leaks.

Project description

A SmartFile Open Source project. Read more about how SmartFile uses and contributes to Open Source software.

SmartFile

Introduction

This package consists of a library and command line tool. The library allows you to dump the Python objects in memory to a dump file.

The command line tool is used to examine the dump file contents.

Creating a dump file.

To add memory dump capability to one of your Python applications, import the caulk library and register a signal handler.

import caulk

caulk.handler()

A number of kwargs can control the operation of the signal handler.

  • signum - The signal to react to, signal.SIGUSR1 by default.
  • path - The path to which to write the dump file /var/tmp by default.
  • name - The name of the dump file, ‘caulk’ by default..

A dump file’s name will be: ‘{0}-{1}-{2}.dump’.format(name, pid, time).

To generate a dump file, use kill:

# kill -usr1 <pid>

Where <pid> is the pid of your running application.

You can also use the low-level API to generate a dump file directly instead of relying on a signal handler.

import caulk

caulk.dump('/var/tmp/my.dump')

Examining a dump file.

To examine the dump file, use the caulk command.

# caulk --classes /var/tmp/caulk-1025-1346255743.435316.dump
count total  average min/max   class
----------------------------------------------------------------------
4     256    64      64/64     unittest.suite.TestSuite
1     64     64      64/64     unittest.runner._WritelnDecorator
1     64     64      64/64     site._Helper
...

For more information on using the caulk command, see it’s help.

# caulk --help

Project details


Release history Release notifications

This version
History Node

0.1-5

History Node

0.1-4

History Node

0.1-3

History Node

0.1-2

History Node

0.1-1

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page