Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug memory allocation #875

Open
ahoarau opened this issue Apr 7, 2024 · 1 comment
Open

Debug memory allocation #875

ahoarau opened this issue Apr 7, 2024 · 1 comment

Comments

@ahoarau
Copy link

ahoarau commented Apr 7, 2024

Hi,
I would like to debug memory allocations at runtime.
Is there some kind of callback we can provide to instrumentalize our code ?
Something like:

   // Starting from here, memory allocations are not allowed
    mi_set_option(mi_option_enable_allocations, 0);
    auto* p = malloc(100); /// --> calls abort() or throws an exception
   void on_alloc() {
        std::print("Allocations detected !");
   }
   // Setup a callback for anything allocation related
    mi_set_callback(&on_alloc);
    auto* p = malloc(100); /// --> calls on_alloc()

Thanks for your help !

@ahoarau
Copy link
Author

ahoarau commented May 14, 2024

@daanx any thoughts ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant