NSImage *randomImage = [[NSImage alloc] initWithContentsOfURL:imageURL];
[randomImage release];
Why does the memory usage still go up? What is using that memory? I release the NSImage object. ( no, its not the URL )
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The images are probably being cached. Take a look at
[img setCacheMode:]Did you actually try doing 500 times or are you guessing at the behaviour? My guess would be that the cache would be cleared at some upper limit – maybe 50mb is not that much?
It is important to note that
-releaseis not equivalent tofree()ordestroy(), even if you call it immediately afteralloc inityou shouldn’t make the assumption that the object has been cleared away. This is why there is so much hate for the-retainCountabusers that think it is a good way to debug memory management.