memory leak may in orderWindow api

mac version:10.13

i just write the below code, then i found the memory rise when execute the for {} statement,1426 is other window's id:

NSWindow* mainWindow = [[NSApplication sharedApplication] mainWindow];
for(int i = 0; i < 60*60*100;++i)
{
//[mainWindow orderWindow:NSWindowBelow relativeTo:1426];
[mainWindow orderFrontRegardless];
}

i doubt the orderWindow api may have memory leaks, can anyone give me some suggest how to explain the situation or give me a alternative api to let my own window always follow a special other application's window.

Replies

So it is OSX App, right ?


Do you repeat a million times for sake of test ?


Not sure to understand what you want. But did you look at HUD (head up display) windows ? In fact they are HUD panels, declared as


@IBOutlet fileprivate weak var hudInfoWindow : NSPanel!

yes, OSX App.

I want to let my window always follow a other application's window below(this api: orderWindow), so I need a scheduled update to make it

What do you mean "follow" ?


I did this by moving a second window (setFrame) when the first window moved, in windowDidMove

thank u for ur reply, but setFrame can change the window's size, but can't let the window below the appointed window("follow" is the that)