Grieve (grieve) wrote,
Grieve
grieve

Another C++ puzzle

aroach figure this out almost immediately. Assume I have a multi threaded application with the follow code:
class A
{
public:
 A()
 {
    m_ = malloc(10);
 }
 ~A()
 {
   free(m_);
 }

private:
 void* m_;
};

void WorkerThread(void* v)
{
  A a;
  // Line 37
}


What could I place after the comment "// Line 37" to make the code leak 10 bytes of memory for every worker thread I created?
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 5 comments