If you compile your program in debug mode and put a breakpoint in ad_exit() and do a stack trace you can find the line where this is happening. It may be that you are doing something like trying to allocate a vector where one of the arguments is uninitialized.