Skip to content

is it possible to statically override malloc for cgo? #4549

@jhance

Description

@jhance

I can't find anything online about doing this (bazel or not), but it would be nice if go_binary could expose malloc attribute (like cc_binary, maybe named cgo_malloc in this case) and/or support --custom_malloc. I could not find an existing way to make this work.

Use case: some go programs might be primarily cgo calls around larger C++ libraries (like for ml) and it would be nice to be able to use mimalloc or tcmalloc there. Presumably this can work with LD_PRELOAD but I was hoping for a static solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions