Skip to main content

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

Metadata

Release history Release notifications | RSS feed

This release

0.1-5 This release

0.1-4

0.1-3

0.1-2

0.1-1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page