title: How to release memory created by SKTexture
body: <p>I have an application that creates scene kit textures using the following:</p>
  
  <pre><code>        let texture = SKTexture(image: image)
  </code></pre>
  
  <p>The problem is that after several calls, the application crashes due to low memory.</p>
  
  <p>I really only need the most recently created texture so when creating a new one, the preview ones' memory can be released, however, Scene Kit seems to be holding on to these textures even when they aren't being used anymore (the nodes are no longer part of the scene).</p>
  
  <p>How can I manually tell Scene Kit to release the memory and cache of the texture so I don't get into the low memory crashing situation?</p>
  
  <p>Also, I know that the SceneKit documentation recommends removing all references to the texture by removing nodes and such, but that should be happening and yet the Texture is not being released.  Is there a good way of debugging and seeing what's holding on to the reference?</p>
  
  <p>In re-reviewing the code, I'm creating a scene to hold the image to be rendered in the primary scene (whose node doesn't change).  Basically, there is an object in the scene that can display an image or a video and that gets changed out by returning a Scene which is used as the material diffuse contents.</p>
  
  <pre><code>let texture = SKTexture(image: image)
  let sprite = SKSpriteNode(texture: texture)
  let scene = SKScene(size: sprite.size)
  sprite.position = CGPointMake(CGRectGetMidX(scene.frame), CGRectGetMidY(scene.frame));
  scene.addChild(sprite)
  </code></pre>
  
  <p>And then being used here:</p>
  
  <pre><code>primaryObjectMaterial.diffuse.contents = scene
  </code></pre>
  
  <p>I would expect once the scene's node material contents are changed, this scene (and the texture and image) would be released as there would no longer be any references to it but perhaps the caching system is hanging onto something or I'm doing something wrong?</p>