eecs280staff / tutorials

Tools and tutorials
https://eecs280staff.github.io/tutorials/
Other
5 stars 4 forks source link

XCode Memory Leak Detection Tutorial #118

Open ScottjBrinley opened 1 year ago

ScottjBrinley commented 1 year ago

What Currently the address sanitizer on mac doesn't detect memory leaks. However, for XCode users, there is a simple and easy way to turn on memory leak detection.

Where This would be best for the leak checking tutorial https://eecs280staff.github.io/tutorials/setup_leakcheck.html

Why I was having trouble detecting a memory leak in project 4 and the tutorial didn't help me because I use XCode on a mac. As such, I did some research to find out if there was a built in implementation and it turns out it is a very simple fix.

References

Link to the website that I used to figure out how to turn on the memory leak checker:

https://zendesk.engineering/ios-identifying-memory-leaks-using-the-xcode-memory-graph-debugger-e84f097b9d15

Go to Product->Scheme->Edit Scheme->Diagnostics, then turn on malloc scribble and malloc stack(as shown in image)

Screen Shot 2023-03-28 at 7 33 35 PM
awdeorio commented 1 year ago

Thanks for the suggestion @ScottjBrinley . You're right that for Xcode users this is definitely the best approach.

EDIT: Do you care to make a PR with a suggested fix? That's why this repo is public! :)

jamesjuett commented 1 week ago

Closing this - the leak checking tutorial was updated to use leaks in #110.

jamesjuett commented 1 week ago

Whoops, I was a bit too hasty. I see now that this is a suggestion to amend the Xcode tutorial, not the leak checking tutorial. (I think?) I don't have a strong opinion on whether that should be added or not.