This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
2
How do I verify I'm not leaking/dangling shared_ptr ?
Post Body
- I can't tell on valgrind's site if it works with
std::shared_ptr
- I'm mostly thinking of situations where there's another
shared_ptr
, which may keep the memory out of the scope. - I also would like to know how to confirm/be able to check. ( I'm aware of using
make_shared
vsnew std::shared_ptr<T>()
because of possible leaks )
As an exercise I'm implementing data structures in c 11.
I believe for a doubly-linked list, to delete it, I simply do:
// deletes list (except if there is an external reference to a list item?)
void DoubleList::clear() {
head = nullptr;
tail = nullptr;
count_ = 0;
}
Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
69,023
Link Karma
3,135
Comment Karma
65,580
Profile updated: 6 days ago
Posts updated: 4 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 11 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/cpp_questio...