Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Alex Zavatone via Cocoa-dev
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription:

Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Rob Petrovec via Cocoa-dev
> On May 1, 2023, at 5:04 AM, Gabriel Zachmann wrote: > > Thanks so much again! > > I tried, and it didn't give me a good clue, though. > What I got as output is: > All zones: 1466 nodes malloced - Sizes: 117040KB[25] 96KB[25] 8KB[2] 5.5KB[1] > 5KB[1] 4KB[2] 3KB[3] 2.5KB[2] 2KB[4] 1.5KB[4]

Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Saagar Jha via Cocoa-dev
malloc is not the only way for your app to leak memory. CGImage in particular allocates its own anonymous VM regions. footprint against your process (man 1 footprint) is a good way to get a quick look at where the system thinks this memory is going. Once you’ve looked at that, Instruments or

Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Gabriel Zachmann via Cocoa-dev
Hm, on closer inspection, maybe it did help. At the moment, at least, the memory footprint of my app levels out at 3GB (which would be OK). In any case, thanks again so much to everybody who chimed in! Best regards, Gabriel > On 1. May 2023, at 12:43, Gabriel Zachmann wrote: > > Thanks a lot

Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Gabriel Zachmann via Cocoa-dev
Thanks so much again! I tried, and it didn't give me a good clue, though. What I got as output is: All zones: 1466 nodes malloced - Sizes: 117040KB[25] 96KB[25] 8KB[2] 5.5KB[1] 5KB[1] 4KB[2] 3KB[3] 2.5KB[2] 2KB[4] 1.5KB[4] 656[15] 592[2] 528[2] 512[2] 448[5] 400[3] 384[2] 368[3] 352[1] 336[1]

Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Gabriel Zachmann via Cocoa-dev
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription:

Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your response! I am not sure, though, I understand what you mean. I've got 3 autoreleasepool's in different places in my source code. They are just @autoreleasepool { ... do something ... } What do you mean by "insufficient use" ? and how do you mean "exit the nearest

Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Sandy McGuffog via Cocoa-dev
Yet another possible issue is that Apple’s frameworks tend to like to hold onto and reuse objects like CALayers. As a result they also hold onto the contents for much longer than you might think. I would at least try imgLayer.contents = nil as soon as you’re sure the layer won’t be displayed

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Christopher Snowhill via Cocoa-dev
Another possibility is insufficient use of autorelease pools. Even if you are freeing your Objective C objects, if you do not exit the nearest autorelease pool block, they will simply accumulate in the heap. Leak tools will not consider these to be "leaked" memory. > On Apr 30, 2023, at 4:41

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Alex Zavatone via Cocoa-dev
What I tested was if it matched the Xcode memory pie chart across several apps. I can’t remember what results I got with terminal leaks or heap commands. Add it to one of your programs and give it a shot! Now I’m interested. Cheers, Alex Zavatone > On Apr 30, 2023, at 1:33 PM, Rob Petrovec

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Rob Petrovec via Cocoa-dev
Oh yeah, Gabriel, another technique you can use is to start your app and create a memgraph _before_ reproducing the problem. Then reproduce the problem and run ‘heap MyApp --diffFrom MyApp.memgraph’. It will show the new objects that have been created since the memgraph was taken, sorted

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Rob Petrovec via Cocoa-dev
Curious, Alex, what does this memoryFootprint function show that running ‘footprint’ or ‘heap’ in Terminal doesn’t? —Rob > On Apr 30, 2023, at 8:12 AM, Alex Zavatone via Cocoa-dev > wrote: > > Memory used query method for iOS. > > https://stackoverflow.com/a/57315975/1058199 > > //

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Rob Petrovec via Cocoa-dev
Hey, Since you have unbounded memory growth, you will likely have one or more object types with a TON of instances in the list on the left. They are likely the source, or part of a chain of objects eating your memory. MallocStackLogging doesn’t show more info about a possible cause.

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot for your response! And thanks a lot for your hints to 'leaks'. I tried it, but I don't see any "ROOT CYCLE" in the output of 'leaks'. (I see a bunch of ROOT LEAKS, but in total it's just 6 kB.) Also, in the Debugger of Xcode, when i click on "Debug Memory Graph" icon, I get lots of

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Alex Zavatone via Cocoa-dev
Memory used query method for iOS. https://stackoverflow.com/a/57315975/1058199 // Created by Alex Zavatone on 8/1/19. // class Memory: NSObject { // From Quinn the Eskimo at Apple. // https://forums.developer.apple.com/thread/105088#357415 class func memoryFootprint() -> Float? {

Re: Memory leak in Apple's image handling frameworks ?

2023-04-30 Thread Alex Zavatone via Cocoa-dev
Use the memory graph debugger, not Instruments. I also have a method published on StackOverflow that lets you check on and print out the amount of memory used. It is for iOS. As for abandoned memory, that also could be the case. An object in memory with no pointer to it. If you want, we

Re: Memory leak in Apple's image handling frameworks ?

2023-04-29 Thread Rob Petrovec via Cocoa-dev
This sounds like Abandoned Memory, not a leak. Abandoned memory is a retain cycle somewhere. Best/easiest way to find those is with a memgraph. Click the little sideways V icon in Xcode’s debugger when the problem is reproducing. Or run ‘leaks MyApp --outputGraph ~’ in Terminal when the