iDevGames Forums
6Mb of memory taken up by glDrawElements - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: 6Mb of memory taken up by glDrawElements (/thread-675.html)



6Mb of memory taken up by glDrawElements - Madrayken - Oct 14, 2009 01:14 PM

I have call the following function in my code.

Code:
glDrawElements(GL_TRIANGLES, VERTEX_INDICES_PER_SPRITE, GL_UNSIGNED_SHORT, myIndexArray);

This one line makes 6mb of difference to my memory footprint. It doesn't matter where I call it, nor how many times. It always takes 6Mb. This seems curious to me. Reading through the documentation, I can't find anything saying this function automatically creates a copy of your pre-allocated buffers in system memory. Anyone else found this?

FYI, I'm using the following code to find out where my memory is going:

Code:
int MemoryReport(void)
{
    struct task_basic_info info;
    mach_msg_type_number_t size = sizeof(info);
    kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO,  (task_info_t)&info, &size);
    if( kerr == KERN_SUCCESS )
    {
        return(info.resident_size);
    }
    else
    {
        return(-1);
    }
}

The reason I'm using this is that since the 3.1 update I can't run my app on hardware directly from XCode, thus removing the possibility of using several Instruments. I'm trying to track that down, too...


6Mb of memory taken up by glDrawElements - Skorche - Oct 14, 2009 03:07 PM

Which instruments work only when launched from XCode? I've never used XCode to connect Instruments or Shark to my application.


6Mb of memory taken up by glDrawElements - Madrayken - Oct 14, 2009 03:40 PM

Wow... what a massive numpty I be. It never occurred to me to run Instruments outside of XCode. All this time I've assumed that everything but 'Shark' is an integral part of XCode. That helps a lot. :-)

[Edit] To add to my already impressive idiocy score, I found that this memory chunk issue only exists in the simulator.