Issue information

Issue ID
#3163
Status
Unable to Fix
Severity
None
Started
Hercules Elf Bot
Jun 2, 2009 4:36
Last Post
Hercules Elf Bot
Jun 2, 2009 4:36
Confirmation
N/A

Hercules Elf Bot - Jun 2, 2009 4:36

Originally posted by [b]Etchel[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3163

Revision is no older than about 2 days. My server locks up every 5 minutes, nearly exactly on the dot. I thought it was because we were using this ranker NPC, but after disabling it, the problem persists. I checked map-server_sql.leaks and it tells me there is a memory leak in script.c, on multiple lines around 2650. Here are teh errors .__.

[codebox]0100 : script.c line 2623 size 48 address 0x0xb3528cc4
0101 : script.c line 2623 size 48 address 0x0xb3528d44
0102 : script.c line 2623 size 48 address 0x0xb3528dc4
0103 : script.c line 2627 size 768 address 0x0xb35821dc
0104 : script.c line 2627 size 768 address 0x0xb35824ec
0105 : script.c line 2627 size 768 address 0x0xb35827fc
0106 : script.c line 2627 size 768 address 0x0xb3582b0c
0107 : script.c line 2627 size 768 address 0x0xb3582e1c
0108 : script.c line 2627 size 768 address 0x0xb358312c
0109 : script.c line 2627 size 768 address 0x0xb358343c
0110 : script.c line 2627 size 768 address 0x0xb358374c
0111 : script.c line 2627 size 768 address 0x0xb3583a5c
0112 : script.c line 2627 size 768 address 0x0xb3583d6c
0113 : script.c line 2627 size 768 address 0x0xb358407c
0114 : script.c line 2627 size 768 address 0x0xb358438c
0115 : script.c line 2627 size 768 address 0x0xb358469c
0116 : script.c line 2627 size 768 address 0x0xb35849ac
0117 : script.c line 2627 size 768 address 0x0xb3584cbc
0118 : script.c line 2627 size 768 address 0x0xb3584fcc
0119 : script.c line 2627 size 768 address 0x0xb35852dc
0120 : script.c line 2627 size 768 address 0x0xb35855ec
0121 : script.c line 2627 size 768 address 0x0xb35858fc
0122 : script.c line 2627 size 768 address 0x0xb3585c0c
0123 : script.c line 2627 size 768 address 0x0xb358622c
0124 : script.c line 2627 size 768 address 0x0xb358653c
0125 : script.c line 2627 size 768 address 0x0xb358684c
0126 : script.c line 2627 size 768 address 0x0xb3586b5c
0127 : script.c line 2627 size 768 address 0x0xb358748c
0128 : script.c line 2627 size 768 address 0x0xb358779c
0129 : script.c line 2627 size 768 address 0x0xb3587aac
0130 : script.c line 2627 size 768 address 0x0xb35883dc
0131 : script.c line 2627 size 768 address 0x0xb3588d0c
0132 : script.c line 2627 size 768 address 0x0xb358901c
0133 : script.c line 2629 size 4 address 0x0xb2acb8ac
0134 : script.c line 2629 size 4 address 0x0xb2acb8ec
0135 : script.c line 3834 size 20 address 0x0xb2c97a7c
0136 : script.c line 2624 size 20 address 0x0xb2c9801c
0137 : script.c line 2624 size 20 address 0x0xb2c982bc
0138 : script.c line 2624 size 20 address 0x0xb2c98a0c
0139 : script.c line 2624 size 20 address 0x0xb2c98acc
0140 : script.c line 3834 size 20 address 0x0xb2c992dc
0141 : script.c line 3834 size 20 address 0x0xb2c994ec
0142 : script.c line 2624 size 20 address 0x0xb2c9951c
0143 : script.c line 2624 size 20 address 0x0xb2c997bc[/codebox]

And the actual source file... (I've only made SLIGHT changes to skill.h and itemdb.h to affect things like maximum number of entries in produce_db etc etc, but the problem persist without the source changes)
Starts at line 2613 and ends at 2638.
CODE
/// Creates a new script state.
///
/// @param script Script code
/// @param pos Position in the code
/// @param rid Who is running the script (attached player)
/// @param oid Where the code is being run (npc 'object')
/// @return Script state
struct script_state* script_alloc_state(struct script_code* script, int pos, int rid, int oid)
{
    struct script_state* st;
    CREATE(st, struct script_state, 1);
    st->stack = (struct script_stack*)aMalloc(sizeof(struct script_stack));
    st->stack->sp = 0;
    st->stack->sp_max = 64;
    CREATE(st->stack->stack_data, struct script_data, st->stack->sp_max);
    st->stack->defsp = st->stack->sp;
    CREATE(st->stack->var_function, struct linkdb_node*, 1);
    st->state = RUN;
    st->script = script;
    //st->scriptroot = script;
    st->pos = pos;
    st->rid = rid;
    st->oid = oid;
    st->sleep.timer = INVALID_TIMER;
    return st;
}


Only basic scripts are enabled, like an unedited job master and unedited healer.

This post has been edited by Etchel: Jun 1 2009, 09:48 PM