Reputation: 3710
I have a function that is creating a variable, but not deallocating it. It passes this object on with a message to another function that deals with the memory management.
My question is how do I suppress the static analyzer warning for what XCode thinks is an over-retained variable? I thought I could use NS_RETURNS_RETAINED for the function that is creating it, but that doesn't work. I wonder if it has something to do with the fact that the variable is passed on through a message?
Upvotes: 4
Views: 799
Reputation: 586
You can suppress the memory warning by doing the following:
Set compiler flags to following by double clicking on it:
-w -Xanalyzer -analyzer-disable-checker
Upvotes: 4
Reputation: 4319
I don't recommend that the warnings are suppressed because they are there for a good reason. Well-coded applications have lots of testing with little or no memory leaks.
However, you can disable the warnings in Xcode 4 by going to the Xcode inspector, and typing "memory" in the search box. There will be a column with a relevant option. On the right, there is an option that you can select.
Upvotes: 0