BlackBerry Programming Tip: Limit COD File Sizes to 64K or Less

RIM will tell you that a COD file can be up to 128K in size. Or, more precisely, contain up to 64K of executable code and 64K of data. Experience tells me otherwise, however, at least for applications that are installed using over-the-air (OTA) download.

If you’re creating an OTA application, make sure that each module in your application does not exceed 64K (65535 bytes) in size. If you don’t, the application may misbehave on certain models. The symptom is that a JVM error occurs when the application runs, requiring the user to reboot the device. Rebooting a device is never acceptable, and certainly not something you’d expect from a Java application.

So if your BlackBerry application is mysteriously crashing the Java VM on certain device models, look carefully at the size of the COD files. If any of them are greater than 64K, move code and data into other modules (create new ones if necessary) until all the modules are less than 64K. The crashes will probably disappear.

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • De.lirio.us
  • digg
  • Furl
  • Reddit
  • TailRank
  • YahooMyWeb

6 Responses to “BlackBerry Programming Tip: Limit COD File Sizes to 64K or Less”

  1. When you say “modules” you mean the different files “.cod” within the main file “.cod” ?

    I’m trying to port several games, and my games work in BlackBerry but they work very slowly, it could be because of my “.cod” within the main “.cod” are greater than 64kb. could you help me?

  2. A module generally corresponds to a .cod file, yes, although there are .cod files that are actually zips of other .cod files.

    In any case, the size of module won’t be affecting the speed of your game. It’s probably just the device itself. Remember that most BlackBerrys are clocked down to save on battery consumption.

  3. Thank very much!!! i really appreciate your answer,

    My game doesn’t seem to be painted well, it’s like it is painted sppliting by areas

  4. Karl G. Kowalski on May 14th, 2008 at 10:21 am

    I have developed and am currently in the middle of developing a large application for BlackBerry (up to 3 CODs and counting). We have not noticed mysterious JVM crashes as a result of OTA downloads….yet. Thanks for the suggestion, and I will make sure my QA team looks into this.

    The only issue I’ve noticed with OTA + Large COD Files is that using the “vanilla” BlackBerry browser will successfully download and install a large (> 64 KB) COD file, whereas using the service provider’s (e.g., AT&T, Verizon, Sprint, etc.) browser the download will fail, consistently. The download seems to fill the progress bar at the same rate, but just when it’s supposed to be completed, the “Application failed to download” message is displayed. RIM’s response has been: Tell your customers to use the BlackBerry browser.

  5. .cod files are zips of other .cod files. A module generally corresponds to a .cod file. Can , I manage the distribution of these sibling .cod files. For the better understanding, the size and couunt of sibling .cod files.

  6. Not sure exactly what you’re asking, Ravi…

Leave a Reply