Returns the amount of memory being used by a context.


func NSGetWindowServerMemory(_ context: Int, _ virtualMemory: UnsafeMutablePointer<Int>, _ windowBackingMemory: UnsafeMutablePointer<Int>, _ windowDumpString: AutoreleasingUnsafeMutablePointer<NSString>) -> Int


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

func NSSetShowsServicesMenuItem(String, Bool) -> Int

Specifies whether an item should be included in Services menus.

func NSCopyBits(Int, NSRect, NSPoint)

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

func NSShowsServicesMenuItem(String) -> Bool

Specifies whether a Services menu item is currently enabled.

func NSDottedFrameRect(NSRect)

Draws a bordered rectangle.

func NSReadPixel(NSPoint) -> NSColor?

Reads the color of the pixel at the specified location.