pfMalloc and new for user-defined classes

New Message Reply Date view Thread view Subject view Author view

From: Satheesh Ganapathi Subramanian (gsat++at++evl.uic.edu)
Date: 10/15/2000 00:26:09


Hi Performers,

I've a question regarding the use of pfMalloc to allocate memory for user
defined classes.

I've a class A, class B and class C as follows:

class A {
public:
        ...
        virtual void initialize() = 0;

};

class B : public A{
public:
        void initialize();
}

class C : public pfTexture{
public:
        A* a;
        static void init();
        void initialize();
}

void C::init()
{
        pfTexture::init();
        initialize();
}

void C::initialize()
{
        a = (B*) pfMalloc (sizeof(B), pfGetSharedArena());
        a->initialize(); /*----------- Get core dump here ------- */
}

When I try to run this program, I get a core dump at the placed marked.
Infact, any virtual function called by A dumps core. Can anyone point the
mistake I'm making. I'm not sure if this is totally a C++ problem or is it
in some way related to pfMalloc.

Thanks
Satheesh


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 00:26:25 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.