×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    5

    System.OutOfMemoryException on load on 256mb devices

    My app does not seem to be working on 256mb devices, and tracking down why is difficult!
    On running the app, before the mainpage.xaml is even loaded I get an System.OutOfMemoryException in System.Windows.dll and then one in Microsoft.Phone.dll

    The exception happens between finishing the App.xaml startup and Navigating to my mainpage.xaml

    Is there anyway I can trap this? Or find out why its happening. Looking at the memory usage of my app at this stage its very low, around 10mb maybe, its hard to say on the graph, but certainly way below 90mb limit.

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: System.OutOfMemoryException on load on 256mb devices

    Hmmm is it XNA+SL app?
    if so are you using very large Bitmap fonts?
    Very large textures?
    Very large sound files?
    how big is your xap file?

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    5

    Re: System.OutOfMemoryException on load on 256mb devices

    Yes its xna.
    MY xna content project is 200kb and only contains images. However my xap is 60mb and it contains a number of resources.
    The resources are not referenced together, only 1 at a time. Do you think that makes a difference though? Would it be better to use them as content or something else?

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    568

    Re: System.OutOfMemoryException on load on 256mb devices

    Also, you could set a break point in App.xaml.cs and step through the code until you reach the OutOfMemoryException.

  5. #5
    Registered User
    Join Date
    Jul 2013
    Posts
    5

    Re: System.OutOfMemoryException on load on 256mb devices

    Quote Originally Posted by theothernt View Post
    Also, you could set a break point in App.xaml.cs and step through the code until you reach the OutOfMemoryException.
    Ive tried that, but the exception is in between steps in native code so it does not break until the navigation fails.

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    568

    Re: System.OutOfMemoryException on load on 256mb devices

    Given that your project has 60MB of images, if you look at the Build Action in the properties of the images - are they set to Resources or Content?

    For a better performance we would suggest that you compile your images with a "Build Action" of "Content" instead of the default "Resource". When adding new images to your project by default the "Build Action" is set to "Resource" (under the Properties window). Make sure to always change this to "Content" in order to reduce the size of your DLL, speeding up both app load and image load.
    Taken from http://www.geekchamp.com/tips/wp7-wo...e-build-action

  7. #7
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: System.OutOfMemoryException on load on 256mb devices

    Hey commonblob,

    its exactly as i thought thats why i knew it was xna, firstly you have to remember that your xap (or very large parts of it) are brought into the memory when you launch an app especially if the resources are content that needs to be fastly available and as you can imagine 60MB for a single app is very big.
    what kind of content do you have in your xna app?

  8. #8
    Registered User
    Join Date
    Jul 2013
    Posts
    5

    Re: System.OutOfMemoryException on load on 256mb devices

    Quote Originally Posted by shai.i View Post
    Hey commonblob,

    its exactly as i thought thats why i knew it was xna, firstly you have to remember that your xap (or very large parts of it) are brought into the memory when you launch an app especially if the resources are content that needs to be fastly available and as you can imagine 60MB for a single app is very big.
    what kind of content do you have in your xna app?
    They are soundbanks for a synth. Quite a lot of them

    Now my project loads, im just unable to use File.Open to read any of the files I get a MethodAccessException, but only on 256mb devices.
    Im just debugging that now

  9. #9
    Registered User
    Join Date
    Jul 2013
    Posts
    5

    Re: System.OutOfMemoryException on load on 256mb devices

    I scrapped File.Open and now use GetResourceStream which works a treat on 256mb devices.

    Thanks to everyone who replied, I know where to come in future to get helpful people

    Much appreciated

Similar Threads

  1. How to load system contacts?
    By sfpskywood in forum Symbian
    Replies: 3
    Last Post: 2010-03-18, 09:13
  2. Will new MMC 256mb work with my3300
    By NiallM36 in forum General Development Questions
    Replies: 0
    Last Post: 2004-01-20, 22:42
  3. 256MB MMC card support in 9210
    By sekar1959 in forum Symbian
    Replies: 0
    Last Post: 2003-11-11, 15:30
  4. cannot load images to devices
    By zivgr in forum Mobile Java General
    Replies: 3
    Last Post: 2003-06-04, 07:35
  5. How can I load my font to the system from my application?
    By Daps in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-11-28, 12:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×