Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Sudden app crash! x(
Started by Aidin Jul 01 2013 02:24 PM

- - - - -
33 replies to this topic

Best Answer Rob Miracle , 06 July 2013 - 07:16 AM

I think you are missing a key part of the math. You treat each side separately. 1890 rounds up to 2048 as does 1720 making it a 2048x2048 block. 1890 rounds up to 2048 but 860 only rounds up to 1024. 2048x1024x4 is 8mb.

[TOPIC CONTROLS]
Page 2 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Yes, that's how I calculated in my last post.

 

Would you, or anyone else, please reply my two questions in my last post pelase?

 

Thanks.



[TOPIC: post.html]
#27

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,925 posts
  • Enterprise

How much audio are you using?  The three sprites are not taking up that much memory.  Perhaps its backgrounds or other items.   You probably could run into some delays particular on older devices. 

 

I would use the same variable and yes, you need to remove it/nil it out or else you're not freeing up the memory.



[TOPIC: post.html]
#28

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

I removed some space from height of my sprite sheet and it is now 1890x860 in 2x mode but the size they take is now around 50MB!

 

So since I removed space from height of my sprite, they should still use 2048x2048 because it's the smallest power of 2 that is bigger than 1890x860 but it's now almost half than before which was 1890x1720.

 

To rephrase my question, since both of the previous and the new size are in the 2048x2048 boundary, they should both consume same amount of texture memory, right? But I'm seeing that it uses less memory in the smaller texture case.

 

Does iPod touch 4G uses this "smallest power of 2 size" ? Apparently not, or I'm missing something here.



[TOPIC: post.html]
#29

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,925 posts
  • Enterprise

  Best Answer

I think you are missing a key part of the math. You treat each side separately. 1890 rounds up to 2048 as does 1720 making it a 2048x2048 block. 1890 rounds up to 2048 but 860 only rounds up to 1024. 2048x1024x4 is 8mb.

[TOPIC: post.html]
#30

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Oh, you are absolutely right.

 

I think I assumed it as it was the case with fixed function graphic cards.

 

Thanks man.



[TOPIC: post.html]
#31

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

Hi guys,

 

I'm having a problem at startup (Exited: Killed: 9) on my iPad 1 - and it's preceded by a stack of Image size errors:

 

e.g. WARNING: Image size (2560,240) exceeds max texture dimension (2048). Image will be resized to fit.

 

This particular file is a spritesheet @2x.

 

Am I crashing because I exceeded the 2048 limit (9 times!), or am I crashing due to loading too much into memory?

 

i.e. If I reorganised the spritesheets to be less than 2048 in any one dimension, would I be OK, or do I need to work on reducing the size of the contents?

 

Thanks,

Nathan.



[TOPIC: post.html]
#32

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Hi guys,

 

I'm having a problem at startup (Exited: Killed: 9) on my iPad 1 - and it's preceded by a stack of Image size errors:

 

e.g. WARNING: Image size (2560,240) exceeds max texture dimension (2048). Image will be resized to fit.

 

This particular file is a spritesheet @2x.

 

Am I crashing because I exceeded the 2048 limit (9 times!), or am I crashing due to loading too much into memory?

 

i.e. If I reorganised the spritesheets to be less than 2048 in any one dimension, would I be OK, or do I need to work on reducing the size of the contents?

 

Thanks,

Nathan.

 


I believe the largest size you can load on iPad 1 is 2048x2048.

 

Beside that, I highly suggest you to utilize s more square image, rather than this long 2560x240 that you currently have, you will save a lot of memory then and also not run into such situation.



[TOPIC: post.html]
#33

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,925 posts
  • Enterprise

Let's look at a couple of things.  First an image that is 2560x240 will actually be 4096 x 256 x 4 in memory.  So first, the 4096 exceeds the maximum texture size so it gets resized to 2048 on the long side, but the way texture memory rounds up you still end up with a 2048x256x4 block of memory.   Each image that size occupies 2 megabytes of memory.   Not only is the computer spending CPU time downsizing the image, it's still having to temporarily handle the larger image. 

 

Which leads to the the next issue.  The hardware in the iPad 1 is really under-powered.  It only has 256M of memory (of which you can realistically expect your app to get to 30-40mb of that before you start having performance issues) and it's CPU and Graphics processing unit (GPU) are relatively speaking.. pokey. 

 

I would suggest that as others have, that you re-arrange your images to fit into a smaller image if possible.  But look at your total memory foot print and see if you can reduce it somehow.



[TOPIC: post.html]
#34

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Contributor

  • 357 posts
  • Corona SDK

Sounds like I've got some crunching to do!

 

Thanks,

Nathan.




[topic_controls]
Page 2 of 2 1 2
 
[/topic_controls]