Member Avatar for Silfro

Hell sadly I dont understand much about memorypool so I tryed to use a memorypool from other sources.

My problem: The gameserver always crash and the debugger shows the following error:
Unhandled exception at 0x01034a65 in GameServer.exe: 0xC0000005: Access violation reading location 0xcdcdcdd5.

First the first memorypool with which everything works fine (except its really old and need much rework)
http://www.verysource.com/code/4490453_1/miruqumemorypool.h.html

This is the second memorypool with which Im getting the error above.
http://hastebin.com/monazasica.m

Code on where I receive the error:

CMObject* CObjectFactory::MakeNewObject(eOBJTYPE Kind,RwUInt32 UniqueID, sGU_OBJECT_CREATE* pBaseObjectInfo)
{
    CMObject* pObject = NULL ;
    switch( Kind )
    {
    case OBJTYPE_MOB:           pObject = MonsterPool->Alloc();         break;
    default:    return NULL;
    }

    pObject->Init(Kind,UniqueID,pBaseObjectInfo); <---------- HERE I RECEIVE THE ERROR

    return pObject;
}

The init function:

BOOL CMObject::Init(eOBJTYPE kind, RwUInt32 UniqueID, sGU_OBJECT_CREATE* pBaseObjectInfo)
{

    UniqueID = UniqueID;

    if(pBaseObjectInfo)
        memcpy(&m_ObjectInfo,pBaseObjectInfo,sizeof(m_ObjectInfo));
    else
        memset(&m_ObjectInfo,0,sizeof(sGU_OBJECT_CREATE));

    return TRUE;
}

I really have no idea why its not working with the second memorypool...

Please show the entire header and source for the CMObject class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.