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

[TOPIC CONTROLS]
Page 1 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]
#1

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Hi,

 

I recently got my MacBook Pro and been moving my dev from a previous iMac to this one and finally now that I did all the steps to make provisioning profile and certificate and whatnot, now that I build and deploy on my devices, I get a very random app crashes.

 

I didn't touch the code and if I build with the iMac, I don't see the crash but when I build with the MacBook Pro, it does random crashes, sometimes before even loading the game, sometimes 2 seconds after game is running sometimes 10 seconds after it.

 

I checked the crash logs and apparently it quits with "signal code 9". I googled it and apparently it's sign of memory leak but I'm no John Carmack but my game doesn't crash after 2 seconds of running.

 

How can I investigate this?



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,922 posts
  • Enterprise

What errors are you getting in your console log??



[TOPIC: post.html]
#3

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

If you mean Xcode's log, all I could get form that is that my app exited with signal code 9.

 

How can I further help?



[TOPIC: post.html]
#4

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Current Apple's developer's section is different from what we have on Corona's blog tutorial on how to make certificate and other stuff and I had to figure it out by myself, can it somehow be related?

 

I have no idea what to check.



[TOPIC: post.html]
#5

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Current Apple's developer's section is different from what we have on Corona's blog tutorial on how to make certificate and other stuff and I had to figure it out by myself, can it somehow be related?

 

I have no idea what to check.



[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,922 posts
  • Enterprise

The Current iOS build guide should be up to date with what the current Apple developer portal is:
 

http://docs.coronalabs.com/guide/distribution/iOSBuild/index.html



[TOPIC: post.html]
#7

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Wow, I could not find this guide with google. Wish you guys would redirect people from the old guide to this one. Thanks.

 

I tested the build with a new iPad 4th Generaiton but it did not fail like 2 iPod touches I tested before, with no lag whatsoever. Could it be that I still have a problem but since iPad is way stronger, the problem won't show itself?



[TOPIC: post.html]
#8

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

I have access to the iPod again and I can see the the seconds after the launch of the game, it gets memory warning from the iOS and seconds after that it gets closed. It even caused the device to restart itself.

 

I copied the log here below and strange thing is, during running of my game Skype and Mail are also reported to have unusual memory usage are also killed with signal code 9:

 

Jul  2 10:03:31 Aidins-iPod SHM_20130701_2346[248] <Warning>: Called vertical_sixty_seconds's enterScene.


Jul  2 10:03:31 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: Loaded next random wave from wave:1, with wave index of: 1


Jul  2 10:03:31 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: We are going to make 1 food(s).


Jul  2 10:03:32 Aidins-iPod MobileMail[76] <Warning>: Received memory warning.


Jul  2 10:03:33 Aidins-iPod SpringBoard[51] <Warning>: Received memory warning.


Jul  2 10:03:34 Aidins-iPod SHM_20130701_2346[248] <Warning>: Received memory warning.


Jul  2 10:03:37 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 1


Jul  2 10:03:37 Aidins-iPod SHM_20130701_2346[248] <Warning>: foodManager: No more foods on the screen, loading next wave.


Jul  2 10:03:37 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: Loaded next random wave from wave:1, with wave index of: 3


Jul  2 10:03:37 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: We are going to make 2 food(s).


Jul  2 10:03:39 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 2


Jul  2 10:03:40 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 3


Jul  2 10:03:41 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 4


Jul  2 10:03:42 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 5


Jul  2 10:03:43 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 6


Jul  2 10:03:43 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 7


Jul  2 10:03:44 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 8


Jul  2 10:03:45 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 9


Jul  2 10:03:46 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 10


Jul  2 10:03:46 Aidins-iPod SHM_20130701_2346[248] <Warning>: foodManager: No more foods on the screen, loading next wave.


Jul  2 10:03:47 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: We passed current time phase, changed wave to: 2


Jul  2 10:03:47 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: Loaded next random wave from wave:2, with wave index of: 8


Jul  2 10:03:47 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: We are going to make 3 food(s).


Jul  2 10:03:47 Aidins-iPod UserEventAgent[12] <Notice>: jetsam: kernel termination snapshot being created


Jul  2 10:03:48 Aidins-iPod wifid[13] <Error>: WiFi:[394436028.077205]: Disable WoW requested by "spd"


Jul  2 10:03:48 Aidins-iPod com.apple.launchd[1] (UIKitApplication:com.apple.mobilemail[0xd8f1][76]) <Notice>: (UIKitApplication:com.apple.mobilemail[0xd8f1]) Exited: Killed: 9


Jul  2 10:03:48 Aidins-iPod com.apple.launchd[1] (UIKitApplication:com.skype.skype[0x2ab3][77]) <Notice>: (UIKitApplication:com.skype.skype[0x2ab3]) Exited: Killed: 9


Jul  2 10:03:48 Aidins-iPod SpringBoard[51] <Warning>: Application 'Mail' exited abnormally with signal 9: Killed: 9


Jul  2 10:03:48 Aidins-iPod SpringBoard[51] <Warning>: Memory level is not normal (2). Delaying auto-relaunch of 'com.apple.mobilemail' for 30 seconds.


Jul  2 10:03:48 Aidins-iPod SpringBoard[51] <Warning>: Application 'Skype' exited abnormally with signal 9: Killed: 9


Jul  2 10:03:48 Aidins-iPod SpringBoard[51] <Warning>: Memory level is not normal (2). Delaying auto-relaunch of 'com.skype.skype' for 30 seconds.


Jul  2 10:03:49 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 11


Jul  2 10:03:49 Aidins-iPod ReportCrash[253] <Notice>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2013-07-02-100349.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0


Jul  2 10:03:50 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 12


Jul  2 10:03:51 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 13


Jul  2 10:03:51 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 14


Jul  2 10:03:52 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 15


Jul  2 10:03:53 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 16


Jul  2 10:03:54 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 17


Jul  2 10:03:54 Aidins-iPod UIKitApplication:com.revengfulninjas.superhungrymonsters[0xef10][248] <Notice>: AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved


Jul  2 10:03:54 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 18


Jul  2 10:03:55 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 19


Jul  2 10:03:55 Aidins-iPod SHM_20130701_2346[248] <Warning>: foodManager: No more foods on the screen, loading next wave.


Jul  2 10:03:56 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: Loaded next random wave from wave:2, with wave index of: 8


Jul  2 10:03:56 Aidins-iPod SHM_20130701_2346[248] <Warning>: loadNextWave: We are going to make 3 food(s).


Jul  2 10:03:57 Aidins-iPod SHM_20130701_2346[248] <Warning>: comboCounter = 20


Jul  2 10:03:58 Aidins-iPod com.apple.launchd[1] (UIKitApplication:com.revengfulninjas.superhungrymonsters[0xef10][248]) <Notice>: (UIKitApplication:com.revengfulninjas.superhungrymonsters[0xef10]) Exited: Killed: 9


Jul  2 10:03:58 Aidins-iPod UserEventAgent[12] <Notice>: jetsam: kernel termination snapshot being created


Jul  2 10:03:58 Aidins-iPod SpringBoard[51] <Warning>: Application 'SHM_20130701_2346' exited abnormally with signal 9: Killed: 9

What can I do?

 

Thanks.



[TOPIC: post.html]
#9

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

I built the SimplePool sample code from Corona with my game's provisioning profile and tried to run it but as soon as I tap on it, it quits, saying this in the console of Xcode:

 


Jul  2 10:23:52 Aidins-iPod com.apple.launchd[1] (UIKitApplication:com.revengfulninjas.superhungrymonsters[0x51da][358]) <Error>: (UIKitApplication:com.revengfulninjas.superhungrymonsters[0x51da]) posix_spawn("/var/mobile/Applications/C03E1B9B-43E6-40AD-B0CA-8E8238548DE3/SHM_20130701_2346.app/SimplePool", ...): Permission denied


Jul  2 10:23:52 Aidins-iPod SpringBoard[51] <Warning>: Unable to obtain a task name port right for pid 358: (os/kern) failure


Jul  2 10:23:52 Aidins-iPod com.apple.launchd[1] (UIKitApplication:com.revengfulninjas.superhungrymonsters[0x51da][358]) <Warning>: (UIKitApplication:com.revengfulninjas.superhungrymonsters[0x51da]) Exited with code: 1


Jul  2 10:23:53 Aidins-iPod SpringBoard[51] <Warning>: Unable to send activation event to <SBApplication: 0x3f5340> com.revengfulninjas.superhungrymonsters animate statusBarOrientation = 1  activate: safe animationStart = 0  deactivate: : (ipc/send) invalid destination port


Jul  2 10:23:53 Aidins-iPod SpringBoard[51] <Warning>: Application 'SimplePool' exited abnormally with exit status 1


[TOPIC: post.html]
#10

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Tried the horse animation sample, same behavior, with this console log:

 


Jul  2 10:25:50 Aidins-iPod com.apple.launchd[1] (UIKitApplication:com.revengfulninjas.superhungrymonsters[0xaa84][388]) <Error>: (UIKitApplication:com.revengfulninjas.superhungrymonsters[0xaa84]) posix_spawn("/var/mobile/Applications/C03E1B9B-43E6-40AD-B0CA-8E8238548DE3/SHM_20130701_2346.app/HorseAnimation", ...): Permission denied


Jul  2 10:25:50 Aidins-iPod SpringBoard[51] <Warning>: Unable to obtain a task name port right for pid 388: (os/kern) failure


Jul  2 10:25:50 Aidins-iPod com.apple.launchd[1] (UIKitApplication:com.revengfulninjas.superhungrymonsters[0xaa84][388]) <Warning>: (UIKitApplication:com.revengfulninjas.superhungrymonsters[0xaa84]) Exited with code: 1


Jul  2 10:25:50 Aidins-iPod SpringBoard[51] <Warning>: Unable to send activation event to <SBApplication: 0xd6c8960> com.revengfulninjas.superhungrymonsters animate statusBarOrientation = 3  activate: animationStart = 0  deactivate: : (ipc/send) invalid destination port


Jul  2 10:25:50 Aidins-iPod SpringBoard[51] <Warning>: Application 'HorseAnimation' exited abnormally with exit status 1



[TOPIC: post.html]
#11

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Damn, I tried both sample apps on the iPad but the both work fine. What is wrong?!



[TOPIC: post.html]
#12

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

I formated the iPod touch 4G, synced it again and copied my game, same behavior. As soon as the game starts, it gets low memory warning and then quits after a like 1-2 seconds.

 

And also Mail and is getting closed with Signal code 9.

 

I don't know what else to do.



[TOPIC: post.html]
#13

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

This may be related to audio because if I don't interact with the game, it won't quit but if I do, and that causes sound effect playback, it will soon crash.

 

I simply playback audio with audio.play, do I have to clean afterwards or something?



[TOPIC: post.html]
#14

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

I'm testing the game on several other devices and it has only this problem on one of deices that is iOS 5.1.1. Is there any known Corona bugs with this version?



[TOPIC: post.html]
#15

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,922 posts
  • Enterprise

Tell us a bit more about your iPod?  What generation?  How much memory does it have?  How much memory is your app using?  Are you trying to handle low memory warnings?



[TOPIC: post.html]
#16

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Thanks Rob for the reply.

 

My iPod is a 4th generation 8Gb iPod Touch. I honestly don't know about it's memory because I think they are all the same between iPods and they only differ on their storage, correct me if I'm wrong.

 

I'm not sure about how much memory my app is using, I tried the profiler from spriteloq and it showed it's using more than 100mb! I honestly have absolutely no idea what causing so much memory because my game is very simple. Maybe that profiler is wrong.

 

You asked about how I handle low memory warning, I honestly don't know how I can get these warnings and how to handle them.

 

Let me know how I can help to help you further.

 

Thanks again, much appreciated.



[TOPIC: post.html]
#17

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,922 posts
  • Enterprise

For the low memory situation, see:

 

http://docs.coronalabs.com/api/event/memoryWarning/index.html

 

100MB is a lot for an older device.  But let's get some real information instead of depending on profilers and such. 

 

local function memoryWarning(event)
    print("************************************")
    print("")
    print("* lowMemory warning - texture memory in use: ", system.getInfo("textureMemoryUsed")/(1024*1024) .. "MB", " lua memory: " .. collectgarbage("count") .. "KB")
    print("")
    print("************************************")
    return true
end
 
Runtime:addEventListener("memoryWarning", memoryWarning)

 

When you get the memory warning, the memory information will print in your console log.



[TOPIC: post.html]
#18

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Thanks for the comprehensive reply, Rob.

 

Yep, problem is the memory usage:

 

Jul  3 13:52:54 Aidin-Zolghadrs-iPod SuperHungryMonsters_rob[1357] <Warning>: *lowMemory warning - texture memory in use: 	108.265625MB	 lua memory: 363.8388671875KB


Jul  3 13:52:54 Aidin-Zolghadrs-iPod SuperHungryMonsters_rob[1357] <Warning>: ************************************

But what's strange is why texture memory is over 100MB. I have two big objects that each have 9 frame animations, I have like 10 small objects that each have 3 frame animations, 3 backgrounds, and some small graphics for combo's. That's all.

 

How can I further track down the bug?

 

Finally some hope at the end of the tunnel.



[TOPIC: post.html]
#19

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi Aidin,

What is the overall canvas size of these "big objects" you mention? Are you using dynamic image selection to pick smaller versions for device(s) with smaller screens? Texture memory can get out of control really fast if you're not careful...

 

Brent



[TOPIC: post.html]
#20

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,922 posts
  • Enterprise

To add to Brent's post, what is your config.lua like?

Can you post some of your display.newImageRect() calls?  Are you using sprites/image sheets?  How big are they?

 

What size are the images you are loading.   Keep in mind that a 1030 x 1030px image is really 2048x2048x4 in memory or 16MB just for that one image.  If your image is bigger than 2048 on each side, say 2050x2050, just for fun, then it's really a 4096x4096x4 sized memory or 64MB.  It doesn't take much for those images to blow out the memory on older devices.

 

One of the reasons why we suggest using the @2x and@4x graphics is that for older devices, you can use smaller images to conserve memory.  Loading in an @4x sized graphic and scaling it down to an appropriate graphic for a smaller screen eats up memory and processing time.



[TOPIC: post.html]
#21

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

To add to Brent's post, what is your config.lua like?

Can you post some of your display.newImageRect() calls?  Are you using sprites/image sheets?  How big are they?

 

What size are the images you are loading.   Keep in mind that a 1030 x 1030px image is really 2048x2048x4 in memory or 16MB just for that one image.  If your image is bigger than 2048 on each side, say 2050x2050, just for fun, then it's really a 4096x4096x4 sized memory or 64MB.  It doesn't take much for those images to blow out the memory on older devices.

 

One of the reasons why we suggest using the @2x and@4x graphics is that for older devices, you can use smaller images to conserve memory.  Loading in an @4x sized graphic and scaling it down to an appropriate graphic for a smaller screen eats up memory and processing time.

 

 

Hi Aidin,

What is the overall canvas size of these "big objects" you mention? Are you using dynamic image selection to pick smaller versions for device(s) with smaller screens? Texture memory can get out of control really fast if you're not careful...

 

Brent

 

Thanks Ron and Brent for the replies.

 

I checked that line Rob posted after each chunk that I load images and I can see that problem lies with those big images, each of those calls takes about 53MB of Texture Memory ™.

 

I do use ImageRect and specify multiple resolution with @ identifier. ( I just do @2x for now but will do the @4x for Retina devices as well).

 

Each of those big objects are in fact 3 image sheets that I load and turn them visible and invisible with "isVisible" flag, due to different gameplay circumstances.

 

Here is the section I load them:

 

function M.new(monsterType, xPos, yPos)
    
    -- Creating monsters
    local newMonster = display.newGroup()
    
    
    local sheetData  =
    {
	width = 105,
	height = 430,
	numFrames = 9,
	
	-- The params below are optional; used for dynamic resolution support
	sheetContentWidth = 945,  -- width of original 1x size of entire sheet
	sheetContentHeight = 430  -- height of original 1x size of entire sheet
    }
    
    local animationSequenceData =   {
        { name = "idle", frames = { 1, 2, 3, 3 }, time = 1000, loopCount = 0 },
--	{ name = "chew", frames = { 4, 5, 6, 7, 8, 8 }, time = 400, loopCount = 1 },
--	{ name = "chew", frames = { 4, 7, 8, 8 }, time = 200, loopCount = 1 },
--	{ name = "chew", frames = { 4, 6, 8, 8 }, time = 200, loopCount = 1 },
	{ name = "chew", frames = { 8, 9, 8, 9, 8, 8 }, time = 500, loopCount = 1 },
--	{ name = "chew", frames = { 8, 8 }, time = 200, loopCount = 1 },
    }
    
    if "Purple" == monsterType then
        
        local mySheet
        
        --============================== Phase 1 ============================== --
        
        -- phase1:Sprite
        mySheet = graphics.newImageSheet("monster_purple_phase_1.png", sheetData );
	newMonster.phase1 = display.newSprite(mySheet, animationSequenceData)
        newMonster:insert(newMonster.phase1) -- Adding body part to the display group.
        
        -- phase1:Offset
        newMonster.phase1:setReferencePoint(display.TopLeftReferencePoint)
        newMonster.phase1.x = newMonster.x
        newMonster.phase1.y = newMonster.y
        
        -- phase1:Animation
        newMonster.phase1:setSequence( "idle" )
	newMonster.phase1:play()
        
        --============================== Phase 2 ============================== --
        
        -- phase2:Sprite
        mySheet = graphics.newImageSheet("monster_purple_phase_2.png", sheetData );
	newMonster.phase2 = display.newSprite(mySheet, animationSequenceData)
        newMonster:insert(newMonster.phase2) -- Adding body part to the display group.
        
        -- phase2:Offset
        newMonster.phase2:setReferencePoint(display.TopLeftReferencePoint)
        newMonster.phase2.x = newMonster.x
        newMonster.phase2.y = newMonster.y
        
        -- Making it invisible since we play phase 1 by default
        newMonster.phase2:setSequence( "idle" )
	newMonster.phase2:play()
--        newMonster.phase2.isVisible = false
        
        --============================== Phase 3 ============================== --
        
        -- phase3:Sprite
        mySheet = graphics.newImageSheet("monster_purple_phase_3.png", sheetData );
	newMonster.phase3 = display.newSprite(mySheet, animationSequenceData)
        newMonster:insert(newMonster.phase3) -- Adding body part to the display group.
        
        -- phase1:Offset
        newMonster.phase3:setReferencePoint(display.TopLeftReferencePoint)
        newMonster.phase3.x = newMonster.x
        newMonster.phase3.y = newMonster.y
        
        -- Making it invisible since we play phase 1 by default
        newMonster.phase3:setSequence( "idle" )
	newMonster.phase3:play()
--        newMonster.phase3.isVisible = false

Please note that I'm showing 1x version here but that 53MB memory I mentioned earlier was from Corona simulator running the game for iPhone 4.

 

So my imagesheet is 945x430 in 1x and 1850x860 in 2x which I believe will take the 2048x2048 texture. (I'm not sure if it's the case for iPod touch 4G as well, please correct me if I'm wrong.)

 

I can't calculate precisely how much memory it will take but I think 2048*2048*4 which is about 16MB and since I load three of them for each monster, that is about that 53MB I reported.

 

So that's the problem?

 

On the side note, I have another question as well, if this code is this bad, why iOS 6 won't close my game and iOS 5 does?



[TOPIC: post.html]
#22

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

I just saw that Rob asked for my config.lua file, here it is:

 

application =
{
    content =
    {
        --xAlign = "center",
        --yAlign = "center",
        --xAlign = "left",
        --yAlign = "top",
        
        width = 320,
        height = 480, 
        scale = "letterbox",
        fps = 60,
        imageSuffix =
        {
            ["@2x"] = 2,    -- images with "@2x" appended will be used for iPad 3
        }
    },
}

 

 



[TOPIC: post.html]
#23

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,922 posts
  • Enterprise

Actually on @2x devices, each of your three images are going to be 2048x1024x4.  Round each side up to the nearest power of two.

 

The problem with the iPod Touch 4 is that it has a retina display (640x960) so it wants to use your @2x graphics, but it only have 256M of memory as opposed to the iPhone 4 which has the same screen at 512M of memory.  Generally you can expect to have 25-50% of the memory available to you depending on the combination of memory size and operating system size.  I would think you probably are only going to have 50-75mb free on that device.

 

Those image sheets should be around 8MB each.  Do you have other images you are loading? Backgrounds? Multi-layer'ed backgrounds?  Audio?



[TOPIC: post.html]
#24

Aidin

[GLOBAL: userInfoPane.html]
Aidin
  • Contributor

  • 401 posts
  • Corona SDK

Rob, why 8MB?

 

2048 x 2048 x 4 = 16.7MB and I load 6 of these which makes it 99.6MB and added with the background and other stuff I think it gets to that 106MB that I posted earlier, but you mentioned that each of these should take 8MB. Am I missing something? My best guess is that you referred to their 1x size.

 

So the only way I think to solve this is to not to load all these at the same time and just load one for each object and when they need, I load the new one and kill the previous one but since this happens like 20 times in a game session, wouldn't it make the game hiccup or stutter?

 

And when I want to load the new image, should I load the file into the previous variable that held the previous image? Does that automatically make the previously loaded image deleted from memory or I should nullify it first?

 

Thanks.



[TOPIC: post.html]
#25

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,922 posts
  • Enterprise

You round each side up to the nearest power of two, so the 860px side rounds up to 1024 so you end up with a 2048x1024x4 texture (and the x4 is for the Red, Green, Blue and Alpha channels of the image)




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