I have a C++ application with an embedded ruby interpreter. I have
overridden the new() operator globally:
void* operator new (size_t size)
if (p==0) // did malloc succeed?
throw std::bad_alloc(); // ANSI/ISO compliant behavior
void operator delete (void *p)
This keeps the GC informed about allocations. It has been working
wonderfully for months but just recently the program has been crashing
badly. I’ve narrowed it down to allocations on some worker threads on
the C++ side. While they do not interact with ruby directly, any
allocations will obviously be routed through xmalloc, and hence might
cause memory corruption.
Does anybody have a clue how to fix this?