As I observe, the more memory you have, the more civ4 consumes (with my 512Mb it stops devouring memory at ~600Mb). It does not look like a memory leak, but rather like some wrong expectation about when it will swap. I think this is garbage collector issue with Python, probably due to its *nix-oriented expectations. I tried to play with GC in game code, but it didn't help (still I am sure, lines I added were actually called).
BTW, Firaxis doesn't control garbage collector AT all, for two reasons:
1) There are no 'import gc as ...' statement anywhere in the code
2) 'gc' is GlobalContext variable in every module (game state), should they've known about garbage collector module name, they would name this variable differently. That's why 'as ...' required in (1).
Executable is actually packed, and its original size seems to be ~40Mb, and it seems that EVERYTHING is python-coded, even graphical engine. No wonder it's so sluggish... Python is the most uncompileable languags since every identifier is resolved by the time it is used. The only thing it can do is to turn strings to their hash values, but still this is a lot of overhead. Not to mention memory overhead which is primary issue with this game.
I don't know why Firaxis went Python. They had their code working in simplest C (if not ASM) in civ1, and I guess C++ in civ3, so they had codebase to continue civ4 same way.
I don't think either that they try to market Python this way. I just see no reason for commerce-oriented company (Firaxis) to market free-of-charge module (Python). Probably they wanted to make modding easier... that can be the only explanation, but IMO the cost is too high.
BTW, Firaxis doesn't control garbage collector AT all, for two reasons:
1) There are no 'import gc as ...' statement anywhere in the code
2) 'gc' is GlobalContext variable in every module (game state), should they've known about garbage collector module name, they would name this variable differently. That's why 'as ...' required in (1).
Executable is actually packed, and its original size seems to be ~40Mb, and it seems that EVERYTHING is python-coded, even graphical engine. No wonder it's so sluggish... Python is the most uncompileable languags since every identifier is resolved by the time it is used. The only thing it can do is to turn strings to their hash values, but still this is a lot of overhead. Not to mention memory overhead which is primary issue with this game.
I don't know why Firaxis went Python. They had their code working in simplest C (if not ASM) in civ1, and I guess C++ in civ3, so they had codebase to continue civ4 same way.
I don't think either that they try to market Python this way. I just see no reason for commerce-oriented company (Firaxis) to market free-of-charge module (Python). Probably they wanted to make modding easier... that can be the only explanation, but IMO the cost is too high.