static inline void force_dump(void) { fprintf(stderr, "\n\033[1m%s\033[0m\n", "Forcing core dump"); fflush(stdout); fflush(stderr); fatal_tty_exit(); raise(SIGSEGV); }
void check_memory_leaks(void) { #if defined(NO_IE) return; #else #ifdef LEAK_DEBUG if (mem_amount || mem_blocks) { fatal_tty_exit(); fprintf(stderr, "\n"ANSI_SET_BOLD"Memory leak by %lu bytes (%lu blocks)"ANSI_CLEAR_BOLD"\n", (unsigned long)mem_amount, (unsigned long)mem_blocks); #ifdef LEAK_DEBUG_LIST fprintf(stderr, "\nList of blocks: "); { int r = 0; struct alloc_header *ah; foreach (ah, memory_list) { fprintf(stderr, "%s%p:%lu @ %s:%d", r ? ", ": "", (unsigned char *)ah + L_D_S, (unsigned long)ah->size, ah->file, ah->line), r = 1; if (ah->comment) fprintf(stderr, ":\"%s\"", ah->comment); } fprintf(stderr, "\n"); }