- Modified map_freeblock_unlock so that aFree errors will report the file/line that INVOKED the function rather than the function itself. NOTE: Do NOT disable the memory manager as that will break this change. This change is to be temporarily set until it can be resolved.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7049 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-06-08 16:02:27 +00:00
parent 604f5b40fe
commit 0fac6d3cb1
4 changed files with 14 additions and 4 deletions

View File

@ -4,6 +4,12 @@ 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/06/08 2006/06/08
* Modified map_freeblock_unlock so that aFree errors will report the
file/line that INVOKED the function rather than the function itself.
[Skotlex[
NOTE: Do NOT disable the memory manager as that will break this change.
This change is to be temporarily set until the afree'd error can be
resolved.
* Updated mob_npc_warp to a three-state config switch. 0 disables. 1 enable * Updated mob_npc_warp to a three-state config switch. 0 disables. 1 enable
only on warps that don't lead to nobranch maps. 2 - enable on all warps. only on warps that don't lead to nobranch maps. 2 - enable on all warps.
[Skotlex] [Skotlex]

View File

@ -393,7 +393,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) {
memmgr_usage_bytes -= head->size; memmgr_usage_bytes -= head->size;
FREE (head_large); FREE (head_large);
} else { } else {
ShowError("Memory manager: args of aFree is freed pointer %s line %d\n", file, line); ShowError("Memory manager: args of aFree is freed pointer %s:%d@%s\n", file, line, func);
} }
ptr = NULL; ptr = NULL;
return; return;

View File

@ -291,13 +291,15 @@ int map_freeblock_lock (void)
* blockを全部削除 * blockを全部削除
*------------------------------------------ *------------------------------------------
*/ */
int map_freeblock_unlock (void) //Temporal debug function to figure out which unlock is causing already free'd pointer errors.
int map_freeblock_unlock_sub(const char * file, int line)
{ {
if ((--block_free_lock) == 0) { if ((--block_free_lock) == 0) {
int i; int i;
for (i = 0; i < block_free_count; i++) for (i = 0; i < block_free_count; i++)
{ //Directly calling aFree shouldn't be a leak, as Free remembers the size the original pointed to memory was allocated with? [Skotlex] { //Directly calling aFree shouldn't be a leak, as Free remembers the size the original pointed to memory was allocated with? [Skotlex]
aFree(block_free[i]); // aFree(block_free[i]);
_mfree(block_free[i], file, line, __func__);
block_free[i] = NULL; block_free[i] = NULL;
} }
block_free_count = 0; block_free_count = 0;

View File

@ -1218,7 +1218,9 @@ int map_getusers(void);
// block<63>í<EFBFBD>œŠÖ˜A // block<63>í<EFBFBD>œŠÖ˜A
int map_freeblock(struct block_list *bl); int map_freeblock(struct block_list *bl);
int map_freeblock_lock(void); int map_freeblock_lock(void);
int map_freeblock_unlock(void); //int map_freeblock_unlock(void);
#define map_freeblock_unlock() map_freeblock_unlock_sub(__FILE__, __LINE__)
int map_freeblock_unlock_sub(const char * file, int line);
// blockŠÖ˜A // blockŠÖ˜A
int map_addblock_sub(struct block_list *, int); int map_addblock_sub(struct block_list *, int);
int map_delblock_sub(struct block_list *, int); int map_delblock_sub(struct block_list *, int);