OutOfMemory error on JasJar

I am having a memory problem with an application on the JasJar.

The application runs fine on iMate PDA2K with 128MB memory (PPC2003SE).

It also runs well on iPAQ on WM5 with 64MB memory (not sure about the exact version of WM5).

However, on the iMate JasJar, also with 64MB memory but a slightly later version of WM5 than iPAQ, I am consistently getting OutOfMemory exception under certain conditions.

I have run the RPM on PPC2003SE but cannot see why I am event close to the limit. I look at the GC Heap over time. Shoud I be looking at something else I have read the blog entries of David Kline about RPM and Steven Pratschners's memory management, but it is not explicit about what I need to look out for. Can anyone point me in the right direction

Haven't managed to get RPM running on JasJar yet. The RPM Windows client does not list the device... Tried the provisioning...

Application notes:

All the SqlCeCommands (about 70 in total) and their parameters (about 100 in total) are created and prepared at application startup to improve runtime performance. I will have to investigate the (performance) impact of creating and disposing on demand.

I rarely call Dispose(). Generally, I let objects e.g. Typed Datasets & DataRows become unreferenced (unreachable) so that GC can collect it whenever it needs to.

My forms are created when required the first time and then kept for later use.

To display very large result sets, I use SqlCeResultSet bound to the Resco Smartgrid



Answer this question

OutOfMemory error on JasJar

  • COLLECTOR

    Ilya, thanks very much
  • berndS

    1. fair point

    2. You're right about that, however it's better practice to dispose of objects properly, rather than relying on GC to clean up after you. I'm sure I've seen a few articles where it advises you to dispose of objects rather than leave them lying around.

    3. True, however it then uses more memory than it needs to. From what I've seen, it's better practice to get rid of an object when you've finished with it

    3. PPCs are just slooooooooooooooooooooooooooow. And you run into memory problems too.


  • Kerry Reynolds

    LouisVanAlphen wrote:

    1. All the SqlCeCommands (about 70 in total) and their parameters (about 100 in total) are created and prepared at application startup to improve runtime performance. I will have to investigate the (performance) impact of creating and disposing on demand.

    2. I rarely call Dispose(). Generally, I let objects e.g. Typed Datasets & DataRows become unreferenced (unreachable) so that GC can collect it whenever it needs to.

    3. My forms are created when required the first time and then kept for later use.

    1. I find that on start-up is where performance suffers most, so I try to make this as quick as possible and let run-time performance suffer

    2. Sloppy! Dispose of unused objects properly

    3. Create and delete forms when you need them/finished with them. Same goes for all objects


  • Andrew Cope

    1. My application is a dedicated mobile component of a much bigger product. Therefore startup performance is less of a concern. Runtime performance is way more important because the user will use the application all day long (field service type of application). If runtime performance is bad then the user's overall daily productivity is negatively impacted.

    2. Many articles on the internet indicates that you don't have to Dispose explicitly. I may have interpreted them incorrectly.

    3. Same argument as in 1. holds. If the form is already created, then it displays quicker. This helps runtime performance.

    I have a PalmOS version of the PDA app and it is much faster (about 3X) than the PPC app and this is what the users are used to.


  • byronatproto

    "All the SqlCeCommands (about 70 in total) and their parameters (about 100 in total) are created and prepared..."

    Well, here's your reason. Dispose of them right away unless you're doing bulk operation. As far as I remember each command eats up about 100-200K of RAM and your application have to fit into 32 MB of virtual address space of which only about 20-25 MB is usually free. That's right, your device can have 1 GB of RAM, but your application is limited to 32MB (minus whatever OS modules are using).

    You can P/Invoke GlobalMemoryStatus() to see amount of virtual memory available to you.

    "2. Many articles on the internet indicates that you don't have to Dispose explicitly. I may have interpreted them incorrectly."< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

     

    I'm afraid you have. Rule of thumb is: if it has Dispose(), you have to call it. Even if it’s not really necessary (e.g. in case of DataSet), there’s no harm in that.



  • John Hennesey

    When using RPM, what value do I look at to determine the total amount of memory my application is using

  • Dominik Mauchle

    None - it's unmanaged memory and RPM only shows managed resources. If you P/Invoke GlobalMemoryStatus(), dwAvailVirtual would be of interest.



  • bola shokry

    I do not (though I suspect that’s’ because they carry execution plan); that’s what I was told quite a while ago when another customer run into the same issue. If exact reason is important to you, please try asking in our dedicated SQL CE/Mobile/Ev forum:

    http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=152&SiteID=1



  • MCP_SS

    Ilya, thanks for the reply. Wow I did not know that the commands are so heavy on memory. Do you know why that is

  • OutOfMemory error on JasJar