title: Loading textures with GLKTextureLoader seems to waste CPU memory?
body: <p>In our game app, it is very important to use textures without pre-multiplied alpha. Hence, for loading textures, as suggested in Apple guidelines, we use the <code>GLKTextureLoader</code>.</p>
  
  <p><strong>Method 1:</strong></p>
  
  <pre><code>...
  GLKTextureInfo* pTextureInfo = [GLKTextureLoader textureWithContentsOfFile:pPath options:pTextureOptions error:&amp;pError];
  ...
  </code></pre>
  
  <p>In the options we can turn off premultiplied alpha and everything is fine, but there seems to be a huge memory problem! </p>
  
  <p>In comparison, we can load textures by using UIImage and CoreGraphics stuff, but then pre-multiplied alpha problem remains. The nice thing here is that we have more control and can easily release pixel data from CPU memory after passing it to the GPU via <code>glTexImage2D(…):</code></p>
  
  <p><strong>Method 2:</strong></p>
  
  <pre><code>...
  uint8_t* pixelData = loadImageDataWithUIImageAndCoreGraphics(…);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
  delete[] pixelData;
  ...
  </code></pre>
  
  <p>When loading textures with <strong>Method 1</strong> Xcode shows memory consumption of 80MB, by using <strong>Method 2</strong> we have memory consumption of only 55MB. If we now create memory leaks by not deleting pixel data (remove the line "delete[] pixelData" in <strong>Method 2</strong>) then memory consumption is also by about 80MB. </p>
  
  <p>Hence, it seems as though <code>GLTextureLoader</code> does not release image/pixel data from CPU memory after passing it to the GPU. Why not? Is there a way to do it manually? How to avoid this huge additional (and unnecessary) memory consumption? </p>
  
  <p>Any help is appreciated. Thanks in advance!</p>