Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

ERROR - memory exeption
Started by Maciej C Sep 19 2014 08:52 AM

6 replies to this topic
error memory
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Maciej C

[GLOBAL: userInfoPane.html]
Maciej C
  • Observer

  • 25 posts
  • Corona SDK

Hi there,

 

An app I'm building work in the emulator (very slow, but works, around 1fps). But when I try to test it on device I get this error (attached file).

 

Project has few art assets and doesnt have any sounds. It uses network requests, transitions and native inputs.

 

I use "CoronaCards.WindowsPhone.2014.2438" version. This is first version I tested so not sure how it worked before.

 

I tried to run sample project (hello world) and it worked in simulator and it worked on device. I did some extra tests with transitions and all worked fine. But when I try to run my whole project (one I wrote for iOS and Android) it starts in simulator but when I select device and try to run it via Debug I get this error.

 

I don't really have any more information than this screenshot. Hope you will be able to help.

 

regards

 

 



[TOPIC: post.html]
#2

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I don't see the attached file.

 

But that said, if you're getting an OutOfMemoryException, then that means you've exceeded the max amount of memory WP8 will allow your app to use.  If this indeed is what you're running into, then that's not a Corona bug.  Your app is simply using too much memory, such as loading too many images and/or too much audio at once.

 

In Visual Studio, notice that the Play toolbar button [>] that you use to build and run your app in the emulator is a drop-down box.  If you click the down arrow on that toolbar button, you'll see other devices that Visual Studio you can emulate.  By default, it emulates a low-end WP8 device named "WVGA 512" which only has 512 MB of RAM.  However, your app does not get to have 512 MB of RAM because the operating system needs some of it for its own purposes.  On a 512 MB device, your app can only have 150 MB by default.  This is documented by Microsoft here...

   http://msdn.microsoft.com/en-us/library/windows/apps/hh855081(v=vs.105).aspx

 

So, first I recommend that you switch to using a different device emulator that supports more RAM to confirm that this is what you're running into.  The "WVGA" (without the 512 at the end) or "WXGA" device emulators support 1024 MB of RAM.  If you're using "Update 2" of Visual Studio, then you can use the "Emulator 8.1 1080P" device which supports 2048 MB of RAM.

 

Once you've confirmed that this is an out of memory issue, then you have 2 options:

1) Lower the memory footprint of your app by loading less images, loading smaller images in size/resolution, load less sounds or stream them audio instead (which you always be doing for large audio files like music).

2) You can try to request the WP8 device to provide your app more memory via the ID_FUNCCAP_EXTEND_MEM manifest entry documented by Microsoft via the link below.  Note that this raises the max memory limit to 180 MB (not a lot), but might be worth a shot if your app is on the edge.

   http://msdn.microsoft.com/en-us/library/windows/apps/jj681682(v=vs.105).aspx

3) You can set up your app to only support 1080 MB of RAM devices only via the ID_REQ_MEMORY_300 manifest entry.  The link above talks about this as well.

 

Does this help?



[TOPIC: post.html]
#3

Maciej C

[GLOBAL: userInfoPane.html]
Maciej C
  • Observer

  • 25 posts
  • Corona SDK

Hi,

 

Thank you for the answer but as I said, It works on emulator (I don't get the error on emulator), I get error when I try to run it on device (Id deon't start at all so there's no way that any images were loaded.

 

My app uses more less 10 images which calculates to more less 1MB, I dont have any sounds.

 

don't know why file didn't attach. Here's file from Dropbox: error_screen

 

I'll keep testing but if you find anything please let me know.

 

Regards



[TOPIC: post.html]
#4

Maciej C

[GLOBAL: userInfoPane.html]
Maciej C
  • Observer

  • 25 posts
  • Corona SDK

I went back and started cutting off all the elements in  my app and I know what the problem was. I'm using new Google Analitics liblary and if that's initiated whole app just crashes. So for now is better to avoid GA lib :). Thanks a lot fot time and help Joshua.

 

Regards



[TOPIC: post.html]
#5

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

Hmm... interesting.  I haven't tried Google Analytics on WP8 before.  How are you adding the library to your project?  Typically, you would want to add its "SDK" by "Reference" instead of adding its *.dll.  The reason is because the referenced 3rd party SDK will have 2 versions of the library; an x86 built version for the emulator and an ARM built version for the device.  If you only add 1 dll by reference, then you're only adding the x86 or ARM version, not both.  Which means it'll run on the emulator but not on the device... or vice-versa.  If you add the "SDK", then Visual Studio will be smart enough to compile in the correct architecture (x86 or ARM) version of the library.



[TOPIC: post.html]
#6

Maciej C

[GLOBAL: userInfoPane.html]
Maciej C
  • Observer

  • 25 posts
  • Corona SDK

Hi,

 

I was using this one:

https://bitbucket.org/Jonjonsson/google-analytics-for-corona-sdk/

 

Which probably uses some API features which are not implemented yet.



[TOPIC: post.html]
#7

Joshua Quick

[GLOBAL: userInfoPane.html]
Joshua Quick
  • Moderator

  • 3,397 posts
  • Corona Staff

I had a quick look at that library and it looks like it is written in pure Lua and it leverages Corona's network.* Lua library.  If it's triggering a OutOfMemoryException, then it sounds like either you or the library is posting a HUGE amount of data.  As in more data than can fit in memory.  Ideally, if you have a ton of data that you want to upload, then you should use network.upload() instead, which uploads the contents of a file as the HTTP body/content.

 

Have you tried this library's sample project by itself on WP8?




[topic_controls]
[/topic_controls]