[bf1942] Zombie players?

Nicholas McGovern hydro at downclan.com
Fri Aug 5 10:48:08 EDT 2005

On Friday 05 Aug 2005 08:56, Einar S. Idsø wrote:
> Forrest Thiessen wrote:
> > Looking through the code, I don't see anywhere where these saved
> > copies of PlayerScore objects *ever* get erased. The scores within
> > for connected players get reset at the beginning of each round, but
> > the datastructures look like they stay there intact until the
> > server is restarted.
> Interesting - I wonder how large portion of the observed memory leak
> is due to this! ;)
> Are there perhaps other Py-objects that are not erased, for instance
> each and every object from a map may have associated Py-objects that
> are never erased.

I haven't looked at the code personally but I would imagine the objects 
only exist through reference from other objects. Once they are no 
longer referenced, Python will garbage collect them and free the 
memory. For example:-

Class Player:
Class Round:
while True:
	# Start new round
	nRound = new Round()
	nRound.addPlayer(new Player())
	# MemLeak (C) EA
	gobble.append(" ")
	# More game stuff
	# End round
	del nRound

Since the player is only ever referenced through the round object, once 
the round is removed, so too is the player. This would explain why 
there's no "del playerX" statement per se.

More information about the Bf1942 mailing list