Function

NSGetWindowServerMemory

Returns the amount of memory being used by a context.

Declaration

NSInteger NSGetWindowServerMemory(NSInteger context, NSInteger *virtualMemory, NSInteger *windowBackingMemory, NSString * _Nonnull *windowDumpString);

Discussion

Calculates the amount of memory being used at the moment by the given context. If NULL is passed for context, the current context is used. The amount of virtual memory used by the current context is returned in the int pointed to by virtualMemory; the amount of window backing store used by windows owned by the current context is returned in the int pointed to by windowBackingMemory. The sum of these two numbers is the amount of the memory that this context is responsible for.

Calculating these numbers takes some time to execute; thus, calling this function in normal operation is not recommended.

If nil is not passed in for windowDumpStream, the information returned is echoed to the specified stream. This fact can be useful for finding out more about which windows are using up your storage.

Normally, NSGetWindowServerMemory returns 0. If NULL is passed for context and there’s no current display context, this function returns –1.

See Also

Auxiliary Functions

NSDrawColorTiledRects

Draws a colored bordered rectangle.

NSInterfaceStyleForKey

Returns an interface style value for the specified key and responder.

Deprecated
NSSetShowsServicesMenuItem

Specifies whether an item should be included in Services menus.

NSCopyBits

Copies a bitmap image to the location specified by a destination point.

Deprecated
NSCountWindows

Counts the number of onscreen windows.

Deprecated
NSCountWindowsForContext

Counts the number of onscreen windows belonging to a particular application.

Deprecated
NSShowsServicesMenuItem

Specifies whether a Services menu item is currently enabled.

NSDottedFrameRect

Draws a bordered rectangle.

NSWindowList

Gets information about onscreen windows.

Deprecated
NSWindowListForContext

Gets information about an application’s onscreen windows.

Deprecated
NSReadPixel

Reads the color of the pixel at the specified location.

Deprecated