Home Help Center

Garbage Collection Troubles

Nis BaggesenNis Baggesen Member ✭✭✭
In an effort to fight a memory leak I've tried activating the Ice garbage collector on my linux server, but it is causing me certain problems.

It seems to run fine as long as there is nothing to collect, but invariably it crashes with the following stack trace (Presumably when some garbage has actually accumulated).
#0  0x08467acd in GameWorld::GameObjectData::__gcReachable (this=0xa3a0334, [email protected]) at /home/qube/svnrunestone/Code/Common/Ice/GameWorldEntities.cpp:9181
#1  0x08467c4a in GameWorld::FixtureData::__gcReachable (this=0xa3a0318, [email protected]) at /home/qube/svnrunestone/Code/Common/Ice/GameWorldEntities.cpp:9976
#2  0x08467e20 in GameWorld::FlawpointData::__gcReachable (this=0xa3a0318, [email protected]) at /home/qube/svnrunestone/Code/Common/Ice/GameWorldEntities.cpp:10731
#3  0x00a85ccc in IceInternal::GC::collectGarbage () from /usr/lib/libIce.so.30
#4  0x00a86694 in IceInternal::GC::run () from /usr/lib/libIce.so.30
#5  0x003d3594 in startHook () from /usr/lib/libIceUtil.so.30
#6  0x0045cb80 in start_thread () from /lib/libpthread.so.0
#7  0x00c919ce in clone () from /lib/libc.so.6

I'm unsure if it is a configuation problem, or some sort of memory corruption. I've merely added Ice.GC.Interval 300 and Ice.Trace.GC=2 to my server configuration files, which seemed straight forward enough, but I still might have missed something.

I have a similar issue if I try to enable garbage collection on my client. Here the program doesn't crash while the garbage collector is running, but rather when I acces a variable that has appearntly been garbage collected despite me holding a reference to it. It crashes when trying to manipulate the reference count as follows:
>	GameClient.exe!IceInternal::incRef(GameWorld::BaseVariant * p=0x0d0e6488)  Line 31 + 0x5	C++
 	GameClient.exe!IceInternal::Handle<GameWorld::BaseVariant>::Handle<GameWorld::BaseVariant>(const IceInternal::Handle<GameWorld::BaseVariant> & r={...})  Line 74 + 0xb	C++
 	GameClient.exe!Actor::setTarget(Maths::Vec3<float> target_={...})  Line 605 + 0x54	C++
 	GameClient.exe!Listener::moveCommand(Maths::Vec3<float> rayCoord={...}, Maths::Vec3<float> rayNormal={...})  Line 354 + 0x3d	C++
 	GameClient.exe!Listener::onButtonPress(Q::Layer & l={...}, const Maths::Vec2<float> & layerRelative={...}, const Maths::Vec2<float> & screenRelative={...}, unsigned int buttons=1)  Line 844	C++
 	qserver.dll!44a3e921() 	
 	qutils.dll!44b38a22() 	
 	qserver.dll!44a3f600() 	
 	qmaths.dll!44905c23() 	
 	qserver.dll!44a3dccc() 	
 	qserver.dll!44a3dcef() 	
 	qserver.dll!44a3e108() 	
 	QKstore.dll!44052eb9() 	
 	QKstore.dll!44079421() 	
 	qserver.dll!44a3c5e8() 	
 	QOSWin32.dll!44541f47() 	
 	user32.dll!77d4eb3e() 	
 	MSCTF.dll!747309a9() 	
 	MSCTF.dll!74730e71() 	
 	user32.dll!77d4eaf2() 	
 	user32.dll!77d48734() 	
 	user32.dll!77d48816() 	
 	user32.dll!77d4885a() 	
 	ntdll.dll!7c90eae3() 	
 	d3d8.dll!6d9d7c05() 	
 	kernel32.dll!7c80262a() 	
 	kernel32.dll!7c802600() 	
 	kernel32.dll!7c8399f3() 	
 	ntdll.dll!7c90e306() 	
 	kernel32.dll!7c80c8d8() 	
 	qsys.dll!44001c6f() 	
 	qdraw.dll!4480b0cd() 	
 	QKstore.dll!44079421() 	
 	qserver.dll!44a37bf2() 	
 	kernel32.dll!7c80a42b() 	
 	qserver.dll!44a38074() 	
 	QKservices.dll!4413106d() 	
 	QKflow.dll!441520d1() 	
 	qsys.dll!4400423e() 	
 	qsys.dll!4400458c() 	
 	kernel32.dll!7c80b50b() 	
 	kernel32.dll!7c8399f3() 	
 	kernel32.dll!7c825bc4() 	

In both cases (server and client) I'm using pure data ice classes - no functions, they are only classes because I want to use inheritance. And the pointers I have directly to ice classes are always wrapped in IceUtil::Handles, so as far as I'm aware I have no uncounted references or the like.

This memory leak isn't a major issue right now, so I can just run without the garbage collector. I simply got curious why it crashed.

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Which Ice version and which operating system and compiler version are you using?
  • Nis BaggesenNis Baggesen Member ✭✭✭
    marc wrote:
    Which Ice version and which operating system and compiler version are you using?

    Sorry about that.

    I'm using Ice 3.0.0. Client side I'm running Windows XP 2002, service pack 2, and compiling with Visual C++ 7.1. Server side we are running Fedora Core 4 linux, and compiling with GCC 4.01

    mvh

    Nis
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Can you upgrade to 3.0.1, and also apply this patch? (Regardless of the GC problem, you should upgrade to 3.0.1, because it has many other bug fixes.)
  • Nis BaggesenNis Baggesen Member ✭✭✭
    marc wrote:
    Can you upgrade to 3.0.1, and also apply this patch? (Regardless of the GC problem, you should upgrade to 3.0.1, because it has many other bug fixes.)

    I'll get right on it. Sorry I didn't found the other thread. Thanks for the quick reply.
  • Nis BaggesenNis Baggesen Member ✭✭✭
    The patch you pointed to seems to be for Ice-3.0.0. Some of the changes seem to have been made in 3.0.1, but (as far as we can see) not all of them. Should we try to make the remaining changes manually or do you have a version 3.0.1 of the patch ?

    Or should I simply try and see if simply upgrading to 3.0.1 solves the problem by itself?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    The patch for garbage collector Ice-3.0.1 is here

    http://www.zeroc.com/vbulletin/showthread.php?t=2041
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Jose is correct, I pointed you to the wrong thread. We could not include this patch in 3.0.1, because it is not binary compatible.
  • Nis BaggesenNis Baggesen Member ✭✭✭
    xdm wrote:
    The patch for garbage collector Ice-3.0.1 is here

    http://www.zeroc.com/vbulletin/showthread.php?t=2041

    Doh. I must be doing something wrong when searching these forums. I guess I'll just start looking manually. But thanks for finding it for me.
Sign In or Register to comment.