class MyClass
{
// empty class with no base class
};
int main()
{
MyClass* myClass = new MyClass();
return 0;
}
Is this a memory leak?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. Even though your class is empty, you still leak memory. There are a few reasons for this:
char).So, your code leaks at least one byte of memory, plus the allocation details, even if your struct is empty.