Too many textures?

I have a test app which can potentially make a lot of textures. I’m worried about a limit on the number of textures I can make. I know when I’m “done” with a created texture, but I don’t see a way to identify the texture as one I won’t be using anymore. I though I read that metal will notice (somehow) that a texture isn’t being used anymore and release associated resources. Is this true? And, if so, how can I make sure that the “notice” will occur?

The GPU will handle deallocation from the GPU. In Swift, you hold onto the MTLTexture until you explicitly deallocate it with = nil.

Apple has this to offer about resource management:

Designate resources as volatile when possible. Use MTLPurgeableState.volatile and setPurgeableState(_:) for textures and buffers the operating system can safely discard under low-memory conditions, and be subsequently recreated or reloaded by your app as needed. This design means your app keeps a cache of idle resources in memory but doesn’t count them toward the memory limit.