re GCD, one thing that wouldn't be too bad would be to have a global (file static) flag which was set to TRUE iff you were in the GCD code. Then the versions of malloc/realloc/free would test the flag and die if it wasn't set. Perhaps not worth it all the time, and maybe not neede given the final check.