I found the main code that consume more memory is located in CCTextureAtlas::mapBuffers(). It will create 2 GL buffers to maintain vertex buffer and index buffer. I write a simple code to demonstrate this below:
// Get the current memory usage by using Windows::Phone::System::Memory::MemoryManager
int * pData = new int;
for (int i = 0; i < 1000; ++i)
glBufferData(GL_ARRAY_BUFFER, 864, pData, GL_DYNAMIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 108, pData, GL_STATIC_DRAW);
// Get the total memory usage again and show the difference
The sizes used here is what I used in the real application. I find that the loop code consumes about 14M memory. But in my understanding, I only create 1000 * 972 bytes totally 1M around. When I look deep in the angle project, seems the cause is CreateBuffer() method does not only create the memory I required. I have no idea what hides behind CreateBuffer(). How to reduce the memory usage here?