//CVMI.cpp
static char* std1[] = {"a","b","c"};
static char* std2[] = {"1","2","3"};
CVMI::CVMI(HWND p)
{
//Does nothing.
}
//CVMI.h
const int cMaxIPAddr = 100;
class CVMI : public VMIListener
{
public:
CVMI(HWND p);
VMI vmi;
bool bOpen;
char sVoceraIPAddr[cMaxIPAddr + 1];
long iMessageID;
};
Above are the code of a class I'm using in a thread and runs a for loop. If put the following three lines within that for loop, then I notice my memory would shoot through the roof.
m_pVMI = new CVMI(m_hNotifyWnd);
delete m_pVMI;
m_pVMI = NULL;
What am I doing wrong here? I though my delete would handle the memory allocation every time already. Or do I have to specifially free up all the resource in a destructor ~CVMI()? . This is my first attempt of troubleshooting a memory leak and being a C++ beginner doesn't make it easier.
Edit:
class VMI_API VMIListener : public Listener
{
public:
// Message acknowledgement. iAckCode is one of AC codes.
virtual void HandleAck(long iMessageID, char* sLoginID, int iAckCode) = 0;
virtual void HandleResponse(long iMessageID, char* sLoginID, char* sResponse) = 0;
virtual void HandleConnectionFailed(void) = 0;
};