I use ScreenCaptureKit, CoreVideo, CoreImage, CoreMedia frameworks to capture screenshots on macOS 14.0 and higher.
Example of creating CGImageRef:
CVImageBufferRef cvImageBufferRef = ..;
CIImage* temporaryImage = [CIImage imageWithCVPixelBuffer:cvImageBufferRef];
CIContext* temporaryContext = [CIContext context];
CGImageRef imageRef = [temporaryContext createCGImage:temporaryImage
fromRect:CGRectMake(0, 0,
CVPixelBufferGetWidth(cvImageBufferRef),
CVPixelBufferGetHeight(cvImageBufferRef))];
I have the next results of profiling with XCode Instruments Memory Leaks & Allocations:
there is constantly increasing memory usage, but no memory leaks are detected, and there are many calls to create IOSurface objects, that have been never released.
The most part of memory - All Anonymous VM - VM: IOSurface.
The heaviest stack trace:
[RPIOSurfaceObject initWithCoder:]
[IOSurface initWithMachPort:]
IOSurfaceClientLookupFromMachPort
I don't have any of IOSurface objects created by myself. There are low-level calls to it. In Allocation List I can see many allocations of IOSurface objects, but there are no info about releasing it.
Due to this info, how can I release them to avoid permanent increasing memory consumption?
Post
Replies
Boosts
Views
Activity
I have the next problem: my app gets a false notification about time change.
// add observer and notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleSystemTimeChangeNotification:) name:NSSystemClockDidChangeNotification object:nil];
// handle system notification about time change
- (void)handleSystemTimeChangeNotification:(NSNotification*)notification
{
CLLogInfo(@"The time change detected");
}
It works without any problem on previous OS: Big Sur, Catalina. Only working with Monterey, Ventura I have these troubles.
Please, give me some recommendations about what I should do. How can I detect time change on macOS (Ventura, Monterey) ?