Sptrace is a general-purpose space utilization tracing system that is conceptually similar to the commercial “Purify” product used to detect leaks and other memory usage errors. It is designed to monitor space utilization in any sort of “heap,” i.e., a region of data storage on some device (nominally memory; possibly shared and possibly persistent) with a flat address space. This software can trace usage of shared and/or non-volatile storage in addition to private RAM (random access memory).

Sptrace is implemented as a set of C function calls that are invoked from within the software that is being examined. The function calls fall into two broad classes: (1) functions that are embedded within the heap management software [e.g., JPL’s SDR (Simple Data Recorder) and PSM (Personal Space Management) systems] to enable heap usage analysis by populating a virtual time-sequenced “log” of usage activity, and (2) reporting functions that are embedded within the application program whose behavior is suspect. For ease of use, these functions may be wrapped privately inside public functions offered by the heap management software. Sptrace can be used for VxWorks or RTEMS real-time systems as easily as for Linux or OS/X systems.

This work was done by Scott C. Burleigh of ACRO for NASA’s Jet Propulsion Laboratory.

This software is available for commercial licensing. Please contact Daniel Broderick of the California Institute of Technology at This email address is being protected from spambots. You need JavaScript enabled to view it.. NPO-41626



This Brief includes a Technical Support Package (TSP).
Document cover
Sptrace

(reference NPO-41626) is currently available for download from the TSP library.

Don't have an account?



Magazine cover
NASA Tech Briefs Magazine

This article first appeared in the September, 2011 issue of NASA Tech Briefs Magazine (Vol. 35 No. 9).

Read more articles from this issue here.

Read more articles from the archives here.


Overview

The document provides a technical overview of Sptrace, a general-purpose space utilization tracing system developed by NASA's Jet Propulsion Laboratory (JPL). Sptrace is designed to monitor memory usage in various types of heaps—regions of data storage with a flat address space—primarily to identify memory leaks and other usage errors. It is conceptually similar to commercial products like "Purify."

Sptrace is implemented through a set of C function calls that can be invoked from the software being analyzed. These functions are categorized into two main classes:

  1. Heap Management Functions: These functions are embedded within the heap management software, such as JPL’s Simple Data Recorder (SDR) and Personal Space Manager (PSM). Key functions include:

    • sptrace_start: Initiates heap usage analysis and returns a handle to a shared memory block for logging.
    • sptrace_join: Connects to an existing analysis episode from another process, allowing for combined logging of heap usage.
    • sptrace_log_alloc: Records an allocation of heap space in the log.
    • sptrace_log_free: Logs the release of allocated heap space, linking it to the corresponding allocation if possible.
    • sptrace_log_memo: Inserts free-form text notes into the log for reporting anomalous states.
    • sptrace_stop: Ends the analysis episode and releases the shared memory block.
  2. Application Program Functions: These functions are embedded within the application code being analyzed. They include:

    • sptrace_report: Prints a snapshot of the log, which can be terse or verbose, detailing allocations, releases, and exceptions.
    • sptrace_clear: Deletes matched allocation and release events from the log, retaining only exceptions and memos, which helps manage log space over time.

The document emphasizes that Sptrace is equipped with wrapper functions for both PSM and SDR systems, enabling analysis of both volatile and non-volatile storage utilization. The research and development of Sptrace were conducted under a contract with NASA, highlighting its significance in aerospace-related technology and its potential applications in broader technological and commercial contexts.

Overall, Sptrace serves as a vital tool for developers and researchers aiming to optimize memory management and enhance software reliability, particularly in complex systems where efficient data handling is crucial.