<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchSource/makeMemoryPressureSource(eventMask:queue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "s:So18OS_dispatch_sourceC8DispatchE24makeMemoryPressureSource9eventMask5queueSo0a1_b1_C15_memorypressure_pAbCE0fG5EventV_So0a1_b1_K0CSgtFZ"
  },
  "title" : "makeMemoryPressureSource(eventMask:queue:)"
}
-->

# makeMemoryPressureSource(eventMask:queue:)

Creates a new dispatch source object that monitors the system for changes in the memory pressure condition.

```
class func makeMemoryPressureSource(eventMask: DispatchSource.MemoryPressureEvent, queue: DispatchQueue? = nil) -> any DispatchSourceMemoryPressure
```

## Parameters

`eventMask`

The set of events you want to monitor. For a list of possible values, see [`DispatchSource.MemoryPressureEvent`](/documentation/Dispatch/DispatchSource/MemoryPressureEvent).

`queue`

The dispatch queue to use when executing the installed handlers.

## Return Value

A dispatch source object that conforms to the [`DispatchSourceMemoryPressure`](/documentation/Dispatch/DispatchSourceMemoryPressure) protocol.

## Discussion

After creating the dispatch source, use the methods of the [`DispatchSourceProtocol`](/documentation/Dispatch/DispatchSourceProtocol) protocol to install the event handlers you need. The returned dispatch source is in the inactive state initially. When you are ready to begin processing events, call its [`activate()`](/documentation/Dispatch/DispatchObject/activate()) method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)