$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] Subject: Re: [shared_ptr] Where is the bug?
From: Kasra Nassiri\(Math & ComSci\) (kasra_n500_at_[hidden])
Date: 2008-10-03 05:25:49
Hi,
Well the bug is in the fact the when you allocated:
B* b = new X();
You have allocated an int extra, thus when you call:
delete b;
You are only destructing what was allocated by B, which cause a sizeof(int) bytes memory leak each time you do this.
Just use a virtual destructor on virtual ~B() ... and that would take care of it all.
With best regards
Kasra Nassiri