sio2PhysicInit memory consumption

View previous topic View next topic Go down

sio2PhysicInit memory consumption

Post  matt on Wed Oct 29, 2008 6:12 pm

I have just tested my application on an actual device (iPod touch 2G, 8GB) for the first time. It quits with status 101 with means out of memory. So I started digging what might be taking so much and I eventually found out that calling sio2PhysicsInit takes approx. 48 MB of memory of ca. 50 MB available...

Do you have any idea what exactly causes so much memory consumption and how to avoid it?

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  sio2interactive on Wed Oct 29, 2008 7:18 pm

Hmmmmm make sure that you have the following values set in btDefaultCollisionConfiguration.h


Code:


struct   btDefaultCollisionConstructionInfo
{
   btStackAlloc*      m_stackAlloc;
   btPoolAllocator*   m_persistentManifoldPool;
   btPoolAllocator*   m_collisionAlgorithmPool;
   int               m_defaultMaxPersistentManifoldPoolSize;
   int               m_defaultMaxCollisionAlgorithmPoolSize;
   int               m_defaultStackAllocatorSize;

   btDefaultCollisionConstructionInfo()
      :m_stackAlloc(0),
      m_persistentManifoldPool(0),
      m_collisionAlgorithmPool(0),
      m_defaultMaxPersistentManifoldPoolSize( 1638 ), //65536
      m_defaultMaxCollisionAlgorithmPoolSize( 1638 ), //65536
      m_defaultStackAllocatorSize( 131072 ) // 5 * 1024 * 1024
   {
   }
};

This should init the physic with around 4MB.

Are you using the version of Bullet that comes with the SDK or you integrate your own?
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  matt on Wed Oct 29, 2008 7:29 pm

Thanks, that's it! I was using the btDefaultCollisionConfiguration.h from SIO2 V1.2... it's not changed there.

Best,
Matt

NB: I'm so disappointed. I thought the Simulator was simulating the device performance accurately, but the framerate dropped from solid ~30 in the Simulator to ~10 FPS :-(

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  sio2interactive on Wed Oct 29, 2008 8:26 pm

Yeah, I know, alot of people think that the simulator is doing the same thing as on the device, but... not really...

Me from what I test, around 100 objects total 5k to 6k or triangles with multitexture + physic + ligthing (4~5 lights) per FOV should give me an FPS around 15 to 30 (which is acceptable)... of course performance may vary depending on what you are doing but... as long as you stick with + or - that you should get good results...

Me when I develop I always run the stuff on the simulator first then when its working Im profiling and testing on the device, so no last minute surprises Wink

Keep your head up dude! Do some optimization and im 100% sure that you'd be able to adjust your stuff to have good performance on the device (shark is your friend, remember that Wink)

Cheers,
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  sio2interactive on Wed Oct 29, 2008 8:36 pm

By the way, you should upgrade to v1.2.1, alot of optimization have been done, that might help you gain a bit more FPS...
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  matt on Thu Oct 30, 2008 3:41 am

sio2interactive wrote:(shark is your friend, remember that Wink)
Yeah, I still need to look into these tools. I'm coming from the Windows area and I'm currently happy that I get around with XCode quite well. I already looked into Instruments but I didn't really get it (although I'm familiar with VTune/CodeAnalyst ;-)). Do you have a good resource at hand which explains profiling and finding memory leaks, in particular for C++ apps on the iPhone?

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  sio2interactive on Thu Oct 30, 2008 4:43 am

Hummmm honestly I learn them by myself, they are pretty intuitive, doesn't matter from what kind of background you are coming from...

Just give it a shot... what I suggest you to check is:

Leaks, Shark and CPU Sample

thats the one that Im using the most...
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  matt on Thu Oct 30, 2008 7:14 pm

I have updated to version 1.2.1, unfortunately it didn't change anything regarding the rendering performance. I have some billboards in my scene which I clone to simulate some snow. Unfortunately, this lowers the framerate by 50% --- do you have any hints how I could speed this up a bit? I know that there's some sorting vodoo going on for transparent surfaces, but that unfortunately also leads to some performance-taking texture switches (I added a little counter for material changes and had five times as much changes). I was thinking about rendering them after everything else... what do you think? Could that work? Or do you have any performance tips?

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  sio2interactive on Thu Oct 30, 2008 8:44 pm

Dude! Don't use billboard for particles WAY to slow on the device... send me your email address and I'll post you my current dev. version with a particle system demo...

Cheers,
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  sio2interactive on Fri Oct 31, 2008 2:21 am

Forget about the email take a look at this link:

http://sio2interactive.com/dump/particle_tutorial.zip

Cheers,
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  matt on Fri Oct 31, 2008 3:49 am

sio2interactive wrote:Forget about the email take a look at this link:
Thanks alot! I'll check this out tonight.

Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  matt on Fri Oct 31, 2008 4:07 pm

There's a particle.tga missing, but besides that --- holy crap, it looks great! I'm just upgrading the project, I'll then try to add particle support to my app.

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

View user profile http://elfrun.net

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  sio2interactive on Fri Oct 31, 2008 6:42 pm

Hehe glad to hear that, however, particles on the device is like "handle with care" too... cuz that adds alot of "triangles" well points but its basically quads you know that are billboarded in hardware...

Keep that in mind,

Cheers,
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: sio2PhysicInit memory consumption

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum