I'm having problems with 3510i phones when playing sound fx for a longer time. If too many sounds have been played during the program is on a (seemingly random) global root overflow error crashes the application. Disabling the sounds from the phone removes the problem.

I run System.gc() from time to time and there is about 80k of free memory all the time and frankly I have no idea what could cause the crash, besides it's sound related bug.

Here's a code snippet from the application sound code:
Code:
public final class Sounds
{
  static Sound[] sounds;

  static void init() {}
  static
  {
    try
    {
      InputStream is = getIS("/sound.dat");
      sounds = new Sound[7];
      sounds[0] = new Sound(readFile(is, 80), Sound.FORMAT_TONE);
      sounds[1] = new Sound(readFile(is, 26), Sound.FORMAT_TONE);
      sounds[2] = new Sound(readFile(is, 17), Sound.FORMAT_TONE);
      sounds[3] = new Sound(readFile(is, 20), Sound.FORMAT_TONE);
      sounds[4] = new Sound(readFile(is, 19), Sound.FORMAT_TONE);
      sounds[5] = new Sound(readFile(is, 19), Sound.FORMAT_TONE);
      sounds[6] = new Sound(readFile(is, 22), Sound.FORMAT_TONE);
      is.close();
    } catch (Exception e) {}
  }

  static public void playSound(int i, int loop)
  {
    if (App.SoundOn) // sounds enabled
    {
      if (sounds == null) init();
      try
      {
        sounds[i].play(loop);
      } catch (Exception e) {}
    }
  }

  ...
}