---
layout: doc
title: general / check_memory
---
# check_memory

### NAME

    check_memory() - run driver debug memory checks

### SYNOPSIS

    string | int check_memory( void | int flag );

### DESCRIPTION

    Runs the driver's debug malloc consistency checks.  This efun is only
    available in drivers built with DEBUGMALLOC and DEBUGMALLOC_EXTENSIONS.

    flag is a bit mask understood by the driver:

        1   include a table of allocation sources in the returned report
        2   suppress leak checks and return 0

    Without flag bit 2, check_memory() returns a diagnostic string.  The
    string contains any warnings found during the memory walk.  With flag bit
    2 set, the driver suppresses the leak-check report and returns 0.

    This efun is intended for driver memory debugging.

### SEE ALSO

    dump_stralloc(3), dump_jemalloc(3), debugmalloc(3)
