Really? What about this piece of code:
Code:
int main()
{
shared_ptr< int > x = new int;
for( ;; )
;
}
The variable x is never used, so its memory is wasted. This is called a "leak" under most definitions of "leak" I've ever seen. Reference counts can't help you if you maintain references to objects you will never use again.
This example looks silly, but in a more complicated program this can lead to actual, measurable memory leaks, i.e. the program memory size is increasing although nothing useful is occupying that memory.