- Changed the memory manager fatal errors when allocating memory to print out the size request as well as the file and line where they originated.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6165 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-04-18 18:37:56 +00:00
parent 83f267044c
commit a0b8ab2e66
2 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/04/18 2006/04/18
* Changed the memory manager fatal errors when allocating memory to print
out the size request as well as the file and line where they originated.
[Skotlex]
* Fixed the delete_timer (@summons, alchemist plants) not invoking * Fixed the delete_timer (@summons, alchemist plants) not invoking
unit_free, hence causing memory leaks and the like. [Skotlex] unit_free, hence causing memory leaks and the like. [Skotlex]
* Applied jA's patch to fix a bug in the scripting engine in regards to * Applied jA's patch to fix a bug in the scripting engine in regards to

View File

@ -257,7 +257,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) {
*(int*)((char*)p + sizeof(struct unit_head_large) - sizeof(int) + size) = 0xdeadbeaf; *(int*)((char*)p + sizeof(struct unit_head_large) - sizeof(int) + size) = 0xdeadbeaf;
return (char *)p + sizeof(struct unit_head_large) - sizeof(int); return (char *)p + sizeof(struct unit_head_large) - sizeof(int);
} else { } else {
ShowFatalError("Memory manager::memmgr_alloc failed.\n"); ShowFatalError("Memory manager::memmgr_alloc failed (allocating %d+%d bytes at %s:%d).\n", sizeof(struct unit_head_large), size, file, line);
exit(1); exit(1);
} }
} }
@ -317,7 +317,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) {
} }
} }
// ここに来てはいけない。 // ここに来てはいけない。
ShowFatalError("Memory manager::memmgr_malloc() serious error.\n"); ShowFatalError("Memory manager::memmgr_malloc() serious error (allocating %d+%d bytes at %s:%d)\n", sizeof(struct unit_head_large), size, file, line);
memmgr_info(); memmgr_info();
exit(1); exit(1);
return NULL; return NULL;