[1002] in Coldmud discussion meeting

root meeting help first first in chain previous in chain previous next next in chain last in chain last

[COLD] Memory leak

daemon@ATHENA.MIT.EDU (Fri May 17 01:12:19 1996 )

Date: Fri, 17 May 1996 06:51:40 +0200
From: silovic@srce.hr (Miroslav Silovic)
To: brandon@tombstone.sunrem.com, coldstuff@cold.org


Okay, I found the bug. This is the cause of the problem:

Most (but not all) natives modify their argument by calling stuff from
src/data directory, that in turn forwards the problem to
prepare_to_modify. And prepare_to_modify discards its argument. So,
most native methods discard their first argument. Those that don't
(like, listlen, strlen... you got the idea. Whole bunch of methods),
leave an extra reference to the arg.

I could fix it the easier way, by dupping the first argument before
calling the method, but that would screw anticipate_assignment call
(which does NOT want its argument to be dupped. Its purpose is to
deal with cases like l=l.replace(1,x), where value of variable l is
going to be immediately overwritten, so it can be freed before the
call to prepare_to_modify on l, leaving, in most cases, only a single
reference to the contents of l, so that it won't be copied).

So I'm going to fix all the modules with *_discard calls, and also
with anticipate_assignment calls wherever appropriate (Lynx hasn't done
this yet).

	Jenner