logo       

static class member deallocation: msg#00734

lib.opencv

Subject: static class member deallocation

Hello,

I use a CvMat* as static class member.

The memory is allocated within the static variable declaration (see
code below).

CvMat* MultiCameraModel::Camera_Param_Common_System::m_geometry =
cvCreateMat(3,3,CV_64F);

With the given code, there is a memory leak, because the data from
CvMat* is not free'd.

Where or how can i deallocate the memory for the static CvMat* (I know
that it is done via cvReleaseMat)? Doing it in the destructor-function
would be a bad idea, since it has a static lifetime.

best regards,
gerd

//HEADER FILE

namespace MultiCameraModel
{

class Camera_Param_Common_System
{
public:
Camera_Param_Common_System(void);
~Camera_Param_Common_System(void);

Camera_Param_Common_System(const
MultiCameraModel::Camera_Param_Common_System& another);
const MultiCameraModel::Camera_Param_Common_System& operator=(const
MultiCameraModel::Camera_Param_Common_System& right);

private:
//static members
static CvMat* m_geometry;
};

}

//SOURCE FILE

//DEFINITION FOR STATIC VARIABLES
CvMat* MultiCameraModel::Camera_Param_Common_System::m_geometry =
cvCreateMat(3,3,CV_64F);

MultiCameraModel::Camera_Param_Common_System::Camera_Param_Common_System(void)
{
}

MultiCameraModel::Camera_Param_Common_System::~Camera_Param_Common_System(void)
{
}

MultiCameraModel::Camera_Param_Common_System::Camera_Param_Common_System(const
MultiCameraModel::Camera_Param_Common_System& another)
{
}

const MultiCameraModel::Camera_Param_Common_System&
MultiCameraModel::Camera_Param_Common_System::operator=(const
MultiCameraModel::Camera_Param_Common_System& right)
{
}






Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing
OpenCV-unsubscribe@xxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise