When using JSON_MEMORY_CALLBACKS, the memory allocations made by the standard library don't go through the registered callbacks, and instead use global operator new. A custom allocator should be passed to all standard library functions to ensure all allocations go through the registered callbacks.
Examples of what I had to change to make this happen:
typedef std::basic_string<char, std::char_traits<char>, my_allocator<char> > json_string;
And every time an std::map is used:
std::map<void *, void *, std::less<void*>, my_allocator<std::pair<const void*, void*> > > mymap;