Most Bison memory allocations can be redirected using macros - in the prolog (between %{ and %} ) you can write
#define YYMALLOC mymalloc #define YYFREE myfree
and Bison will then call mymalloc and myfree instead of malloc and free . However, he expects that any functions you provide should have exactly the same type signature as the standard malloc and free ; There is no way to make it pass additional / different arguments. And I would not use functional macros if I were you. Even worse, in my copy (Bison 2.4.1), yypstate_new calls malloc directly, without overriding - this is probably a mistake.
zwol
source share