放置しないケースだとメモリリークしてないです。

#include <string>
#include <iostream>
#include <boost/shared_ptr.hpp>
using namespace std;
using namespace boost;

class cls {
public:
shared_ptr<string> str;
cls(){ str=shared_ptr<string>(new string);str->resize(1<<20,'a'); }
};

void fnc(shared_ptr<cls> p){
//cout<<p->str->substr(0,10)<<endl;
}


int main(){
int n;
for(n=0;n<1000;n++) {
shared_ptr<cls> p=shared_ptr<cls>(new cls);
cout<<n<<endl;
fnc(p);
}
}