c++ - How to free up heap memory created inside class -
i have class called "frame" has 2 member variables; 1 int , other void*. after instantiating frame, deallocate memory space created void* seems not clearing space. can please point me wrong code ?
class frame { public: frame(int a) { = m_a; } frame(int a, void* b) { = m_a; b = m_b; } ~frame() { delete m_b; } public: int m_a; void* m_b; }; queue<frame*> q; size_t m_bufferbytes = 5606400; int main(void) { void* n = operator new(10000); frame* f = new frame(1, n); delete f->m_b; delete f; cout << "test\n"; return 0; }
wiki
Comments
Post a Comment