Doing a build for an android device i get: Segmentation fault: 11

Could really use some help getting past this … it seems a show stopper and there is scant little info in the terminal window once the simulator crashes.

Copyright (C) 2009-2012 C o r o n a L a b s I n c . 2013-01-22 15:39:10.619 Corona Simulator[1753:707] Version: 2.0.0 2013-01-22 15:39:10.620 Corona Simulator[1753:707] Build: 2012.985 Invalid memory access of location 0x10 rip=0x10000c4ad /Applications/CoronaSDK/simulator: line 9: 1753 Segmentation fault: 11 "$path/Corona Simulator.app/Contents/MacOS/Corona Simulator" $\* [import]uid: 118012 topic_id: 35208 reply_id: 335208[/import]

Looked for a while longer and ran across:

http://developer.coronalabs.com/forum/2012/11/24/build-android-using-non-debug-keystore-crashes-corona-simulator-durring-build

Seems i have a similar issue [import]uid: 118012 topic_id: 35208 reply_id: 139970[/import]

Have you made sure your your keystore is correct?

Just in general terms, a Segment Violation is your application is trying to access memory that it’s not allowed to. Typically this happens when a variable is supposed to be a pointer to an object or function and it gets overwritten by some small integer value. In this case, its trying to access 0x10 (16) as a memory address and that is invalid.

Typical causes of this are using storyboard and you leave a timer running that calls some function and you’ve changed scenes and the previous scene gets purged, you’re going to crash. Anything that calls a function when it finishes that wasn’t cleaned properly can generate this crash.

I’m not sure what you could be doing early in the process that would do that though.
[import]uid: 199310 topic_id: 35208 reply_id: 139995[/import]

Are you calling os.exit() in an applicationSuspend listener?

If so, the issue isn’t with the build but with the fact that we suspend the app during a build (causing the listener to be called and corrupt memory due to the way the simulator has to fake os.exit()). It’s an intermittent bug that’s proving hard to track down so if you have a reproducible case please send it in.

One immediate way to work around this is to check system.getInfo("environment") and only call os.exit() if it doesn’t return “simulator”. [import]uid: 199237 topic_id: 35208 reply_id: 140132[/import]

Yep that was my issue … your suggestion is perfect. Thanks!!

[import]uid: 118012 topic_id: 35208 reply_id: 140155[/import]

I recommend that you never call the [lua]os.exit()[/lua] function and use the [lua]native.requestExit()[/lua] function instead, which will close the Android app gracefully. Have a look at the API documentation here…
http://docs.coronalabs.com/api/library/native/requestExit.html
[import]uid: 32256 topic_id: 35208 reply_id: 140160[/import]

Josh’s advice is better than mine … if you find yourself thinking os.exit() is the answer to a problem then you probably need to rethink things :slight_smile: [import]uid: 199237 topic_id: 35208 reply_id: 140244[/import]

Looked for a while longer and ran across:

http://developer.coronalabs.com/forum/2012/11/24/build-android-using-non-debug-keystore-crashes-corona-simulator-durring-build

Seems i have a similar issue [import]uid: 118012 topic_id: 35208 reply_id: 139970[/import]

Have you made sure your your keystore is correct?

Just in general terms, a Segment Violation is your application is trying to access memory that it’s not allowed to. Typically this happens when a variable is supposed to be a pointer to an object or function and it gets overwritten by some small integer value. In this case, its trying to access 0x10 (16) as a memory address and that is invalid.

Typical causes of this are using storyboard and you leave a timer running that calls some function and you’ve changed scenes and the previous scene gets purged, you’re going to crash. Anything that calls a function when it finishes that wasn’t cleaned properly can generate this crash.

I’m not sure what you could be doing early in the process that would do that though.
[import]uid: 199310 topic_id: 35208 reply_id: 139995[/import]

Are you calling os.exit() in an applicationSuspend listener?

If so, the issue isn’t with the build but with the fact that we suspend the app during a build (causing the listener to be called and corrupt memory due to the way the simulator has to fake os.exit()). It’s an intermittent bug that’s proving hard to track down so if you have a reproducible case please send it in.

One immediate way to work around this is to check system.getInfo("environment") and only call os.exit() if it doesn’t return “simulator”. [import]uid: 199237 topic_id: 35208 reply_id: 140132[/import]

Yep that was my issue … your suggestion is perfect. Thanks!!

[import]uid: 118012 topic_id: 35208 reply_id: 140155[/import]

I recommend that you never call the [lua]os.exit()[/lua] function and use the [lua]native.requestExit()[/lua] function instead, which will close the Android app gracefully. Have a look at the API documentation here…
http://docs.coronalabs.com/api/library/native/requestExit.html
[import]uid: 32256 topic_id: 35208 reply_id: 140160[/import]

Josh’s advice is better than mine … if you find yourself thinking os.exit() is the answer to a problem then you probably need to rethink things :slight_smile: [import]uid: 199237 topic_id: 35208 reply_id: 140244[/import]