CEF Browser Application growth on MAC

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

CEF Browser Application growth on MAC

Postby ccbournejr » Fri Dec 03, 2021 11:43 am

OS: Mac
CEF Build: cef_binary_95.7.18+g0d6005e+chromium-95.0.4638.69_macosx64

I was looking for help on my CEF browser application seemingly growing when I actuate mouse movements in an automated test environment.
My application is filtering on some NSEvent's in my NSApp sub class MyApp using an overload on sendEvent
Once I am finished, it super's to sendEvent. This creates memory that appears to leak in Instruments from the stack below. I build with ARC turned on, but when I wrap the code with @autoreleasepool {}, the below frame disappears from my live_allocations in malloc_history and the image shrinks accordingly. That brings up more questions than it really answered. Does CEF code build with ARC on by default? If the memory component is created with ARC/on, then I'd think that a release pool would be benign to the allocation. If it's created without ARC (GC), then (I read) a release pool will inspire the GC to operate faster, but I'm not sure why the GC wouldn't kick in during the hour of wall time that my test runs.

Thanks in advance.

Code: Select all
MyApp       
89:        [super sendEvent:theEvent];


Code: Select all
Stack: 07d1075402bf79699b7c58cac025b11d
        Size: 84702acb6c50630e1136e8374ae9d90a -- 51069 (26.5M)
start  (in libdyld.dylib) + 1  [0x7fff204eff3d]
main  (in App) + 344  [0x10b6d4d18]  main.m:88
NSApplicationMain  (in AppKit) + 816  [0x7fff22d97e6c]
-[NSApplication run]  (in AppKit) + 586  [0x7fff22dc3c69]
-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]  (in AppKit) + 1364  [0x7fff22dd1945]
_DPSNextEvent  (in AppKit) + 2046  [0x7fff22dd3610]
AEProcessAppleEvent  (in HIToolbox) + 54  [0x7fff28824012]
aeProcessAppleEvent  (in AE) + 448  [0x7fff263a4c23]
???  (in AE)  load address 0x7fff263a0000 + 0xbf0e  [0x7fff263abf0e]
???  (in AE)  load address 0x7fff263a0000 + 0xc7f3  [0x7fff263ac7f3]
_NSAppleEventManagerGenericHandler  (in Foundation) + 80  [0x7fff21330176]
-[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:]  (in Foundation) + 308  [0x7fff21330306]
-[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:]  (in AppKit) + 665  [0x7fff22dd8f87]
-[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:]  (in AppKit) + 541  [0x7fff22dd9331]
-[NSApplication _sendFinishLaunchingNotification]  (in AppKit) + 208  [0x7fff22ddc192]
-[NSApplication _postDidFinishNotification]  (in AppKit) + 305  [0x7fff22ddc440]
-[NSNotificationCenter postNotificationName:object:userInfo:]  (in Foundation) + 59  [0x7fff21304bb8]
_CFXNotificationPost  (in CoreFoundation) + 736  [0x7fff20592cce]
_CFXRegistrationPost  (in CoreFoundation) + 496  [0x7fff2065d454]
___CFXRegistrationPost_block_invoke  (in CoreFoundation) + 49  [0x7fff2065d4d9]
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__  (in CoreFoundation) + 12  [0x7fff205c1a53]
-[AppDelegate applicationDidFinishLaunching:]  (in Examplify) + 7249  [0x10b6e8b51]  AppDelegate.m:172
CefRunMessageLoop()  (in Chromium Embedded Framework) + 196  [0x121235004]  context.cc:270
CefMainRunner::RunMessageLoop()  (in Chromium Embedded Framework) + 263  [0x12125ea57]  main_runner.cc:287
base::RunLoop::Run(base::Location const&)  (in Chromium Embedded Framework) + 880  [0x121605470]  run_loop.cc:134
base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta)  (in Chromium Embedded Framework) + 598  [0x121650516]  thread_controller_with_message_pump_impl.cc:467
base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*)  (in Chromium Embedded Framework) + 131  [0x1216adc03]  message_pump_mac.mm:157
base::MessagePumpNSApplication::DoRun(base::MessagePump::Delegate*)  (in Chromium Embedded Framework) + 268  [0x1216af21c]  message_pump_mac.mm:752
-[MyApp sendEvent:]  (in App) + 1155  [0x10b83d893]  MyApp.mm:89
-[NSApplication(NSEvent) sendEvent:]  (in AppKit) + 3578  [0x7fff22f5baae]
-[NSWindow(NSEventRouting) sendEvent:]  (in AppKit) + 347  [0x7fff22f5ca06]
-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]  (in AppKit) + 4256  [0x7fff22f5dcc6]
-[NSTrackingArea mouseMoved:]  (in AppKit) + 133  [0x7fff230882ab]
_CF_forwarding_prep_0  (in CoreFoundation) + 120  [0x7fff205adc18]
___forwarding___  (in CoreFoundation) + 805  [0x7fff205adfc8]
+[NSInvocation _invocationWithMethodSignature:frame:]  (in CoreFoundation) + 127  [0x7fff205ae2f3]
_malloc_zone_calloc  (in libsystem_malloc.dylib) + 188  [0x7fff20316075]
CONTENT:  NSInvocation._retdata (malloc)  C  CoreFoundation
51069 (26.5M) CONTENT:  NSInvocation._retdata (malloc)  C  CoreFoundation
END_OF_STACK
ccbournejr
Techie
 
Posts: 30
Joined: Mon Aug 23, 2021 7:47 am

Re: CEF Browser Application growth on MAC

Postby magreenblatt » Fri Dec 03, 2021 12:27 pm

Chromium on MacOS does not build with ARC enabled. Wrapping your code with @autoreleasepool {} should be fine/expected, from my understanding.
magreenblatt
Site Admin
 
Posts: 12384
Joined: Fri May 29, 2009 6:57 pm

Re: CEF Browser Application growth on MAC

Postby ccbournejr » Fri Dec 03, 2021 12:50 pm

Thanks for the quick response. I will wrap problem areas - that I empirically uncover with Instruments - with release pool blocks.
ccbournejr
Techie
 
Posts: 30
Joined: Mon Aug 23, 2021 7:47 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 47 guests