Skip to content

test_capi fails on OpenBSD: the allocator fills freed memory with junk #154502

Description

@serhiy-storchaka

Bug report

test_capi.test_mem.PyMemMallocDebugTests.test_pyobject_freed_is_freed fails on OpenBSD:

AssertionError: object is not seen as freed

The test disables junk filling in the system allocator, so that the pattern written by the debug hooks survives free(), but it only does this for jemalloc (added in gh-90421 for FreeBSD):

    # FreeBSD: instruct jemalloc to not fill freed() memory
    # with junk byte 0x5a, see JEMALLOC(3)
    MALLOC_CONF="junk:false",

OpenBSD has its own allocator, which fills freed memory with junk by default and is configured by MALLOC_OPTIONS, not MALLOC_CONF:

$ env PYTHONMALLOC=malloc_debug MALLOC_CONF="junk:false" ./python -c '...'
AssertionError: object is not seen as freed
$ env PYTHONMALLOC=malloc_debug MALLOC_OPTIONS=j ./python -c '...'
(no error)

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions