Log in

View Full Version : Memory leaks


bergalas
08-26-2009, 09:58 AM
Apparently the server has some rather large memory leaks in about 3 hours idle 5 dynamic zones ate 2+ gigs of ram. Has anyone else noticed such problems?

gaeorn
08-26-2009, 01:00 PM
I know there were some memory leaks, but nothing that large. I've been pretty busy in RL lately, but I'm hoping when things settle down I will have time to go through and do a bit of cleanup on the code. Memory leaks were one of my planned targets to fix.

drakelord
08-26-2009, 10:33 PM
Here is some logs that might assist you with fixing the memory leaks.

Used valgrind to log world and zone servers on Debian 5 using revision 964.

http://www.netherealm-studios.com/world_log.rtf

http://www.netherealm-studios.com/zone_log.rtf

drakelord
08-27-2009, 12:37 AM
Err, I should have said Rev 961. Silly typo, and I can't go back and edit it, :X

AndMetal
08-27-2009, 05:59 AM
Here's a fix for a smaller leak based on the logs:


14 bytes in 1 blocks are definitely lost in loss record 5 of 55
at 0x402209E: operator new[](unsigned) (vg_replace_malloc.c:268)
by 0x817BC51: Database::GetZoneLongName(char const*, char**, char*, float*, float*, float*, unsigned*, unsigned*) (database.cpp:1112)
by 0x82C9A81: Client::ZonePC(unsigned, unsigned, float, float, float, float, unsigned char, ZoneMode) (zoning.cpp:473)
by 0x82CA3BC: Client::ProcessMovePC(unsigned, unsigned, float, float, float, float, unsigned char, ZoneMode) (zoning.cpp:447)
by 0x82CA5E4: Client::MovePC(unsigned, float, float, float, float, unsigned char, ZoneMode) (zoning.cpp:404)
by 0x82CA627: Client::GoToDeath() (zoning.cpp:711)
by 0x8118406: Client::Death(Mob*, int, unsigned short, SkillType) (attack.cpp:1557)
by 0x81190CC: Mob::CommonDamage(Mob*, int&, unsigned short, SkillType, bool&, signed char, bool) (attack.cpp:3013)
by 0x8119D23: Client::Damage(Mob*, int, unsigned short, SkillType, bool, signed char, bool) (attack.cpp:1287)
by 0x8115D11: NPC::Attack(Mob*, int, bool) (attack.cpp:1745)
by 0x813F481: Mob::AI_Process() (MobAI.cpp:1179)
by 0x8104F73: NPC::Process() (npc.cpp:623)



Index: T:/svn/trunk/EQEmuServer/zone/zoning.cpp
================================================== =================
--- T:/svn/trunk/EQEmuServer/zone/zoning.cpp (revision 966)
+++ T:/svn/trunk/EQEmuServer/zone/zoning.cpp (working copy)
@@ -476,6 +476,7 @@

if(!pZoneName) {
Message(13, "Invalid zone number specified");
+ safe_delete_array(pZoneName);
return;
}
iZoneNameLength = strlen(pZoneName);
@@ -655,6 +656,8 @@
}
}
}
+
+ safe_delete_array(pZoneName);
}

void Client::GoToSafeCoords(uint16 zone_id, uint16 instance_id) {

prickle
10-02-2009, 02:22 PM
I haven't noticed any memory leaks with dynamic zones, yet (running rev 974). However, I HAVE noticed that some PoP zones (e.g. poinnovations and a couple of others) like to chew on 200+ MB of RAM when launched statically.

I'm running ~most~ zones on my server statically because I've noticed certain anamolies with running them dynamically that detract from the "MMORPG"/persistent world aspect of the game. A couple of things I've noticed when all zones are dynamic:
-the lack of weather change if you only spend a few minutes in a zone
-the ~same~ thing happening if you pass the same point in a zone in approximately the same time every time you enter the zone (e.g. Lodizal ALWAYS just spawns, and ALWAYS wandering around the gnolls in Iceclad)
-wandering mobs can almost always be found in the same location
-"Spawn cycles" in zones like Frontier Mountains don't work right if the zone is dynamic, and you die a lot....

Right now, I'm working on a balance of dynamic and static zones to maintain server performance, minimize RAM usage, and maintain a "persistent feel" to the world on my personal server...

ChaosSlayerZ
10-02-2009, 08:18 PM
you can turn on Persistent Zone state. What this will do for dynamic zones- it will RECORD what/where things were when zone was shutdown and when it reboots - it will put things back exactly how they were last time on

prickle
10-02-2009, 09:34 PM
I missed that. I've enabled that so the zones on my server that are still dynamic will be more persistent when I come back to them. Though, I don't think it'll be exactly like a statically loaded zone, but it will will be better than a zone that just relaunched everytime I enter it.

Thanks for the pointer; I thought that was enabled by default. Obviously, I was mistaken ;)

ChaosSlayerZ
10-02-2009, 11:53 PM
Important note - the Persistent state will carry on even after entire world server has been shut down and restarted, which leads to an issue that, when persistent state was turned on - ANY alterations to DB would prevent server from booting again until you turned it off - since the recorded data was using the DB as base and once base would be altered it would no longer match the PS recording, causing the crashes.
This was a year ago however, so changes to the code may have already addressed this issue.

KLS
10-03-2009, 08:09 PM
Lucky for you I completely disabled persistent state loading a while back.

No one really ever had good experiences with persistent state loading, it was unmaintained and filled with bugs and exploits.

ChaosSlayerZ
10-03-2009, 08:46 PM
LOL I always thought it was nice alternative to running crap load of static zones =P