• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem : Memory Optimization in j2me application

 
Rishi Tyagi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Sorry but i am going to ask some foolish questions. i have to ask these as i am beginner in j2me programming rather in programming.
I am making some simple games in j2me, But facing some problems regarding optimization of the programs.
Being a biginer i want to know what does the optimization word really mean in case j2me programs and how can i implemet it,
Is there any tool available on the net which can help to test the performance of the j2me programs.
Actually i have made an application which is really very big in size ( around 50 K) and sometimes it gives heap error while running on the real phone.
Now i want to ask
1-how come i get to know about the bugs regarding the memory utilization in my j2me programs,
2-how can i test the programs for its performance,
3-how can i tune the performance of the program made in j2me.
Although i know that these are some basic questions but i will appreciate if anybody can clear my above points.
Regards,
Rishi
 
a sanjuan
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you did not mention what tool you're using, but if you're using the j2me wireless toolkit from sun, the ktoolbar on the version 1.04 has some neato features that will allow you to (1) adjust the performance parameters (e.g. VM emulation speed); and more importantly (2) it has a memory monitor and profiler that can show memory usage by your app, all objects created, etc. very handy features. you can also adjust the heap size to simulate some real device.
here are some general j2me optimization tips that i bookmarked:
general j2me optimization:
http://wireless.java.sun.com/midp/ttips/appsize/
object handling to optimize:
http://www.microjava.com/articles/techtalk/object_lists
performance tuning (PDF file):
http://wireless.java.sun.com/midp/chapters/j2meknudsen/Chap10.pdf
 
Rishi Tyagi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sanjuan,
I thing you have provided me the right links.
I will try on it and will come back with the results.
Thanks again for the help.
Regards,
Rishi
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing special about optiming under J2ME, the only difference is your upper bounds are often lower. Aside from that, just follow the standard rules, proceedures, and tools for optimizing.
--Mark
 
Rishi Tyagi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark,
Thanks a lot for the response.
Actually i have made one game application for one of my client and sent it to him for checking which works fine while running on emulator or the real phone with its big size 52k,
But My client needs some more optimization regarding memory utilization and size of the application as i was unable to find any problem in my application so i found it better to raise a question in the foroum.
Although sanjuan's suggession has been proved really usefull for me as i am new to j2me and not able to think as wide as in other java API's.
If anybody else can suggest anything new and better way for checking the same then i will be highly obliged for the answer.
Regards,
Rishi
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I was experimenting with a test application on the Palm, I had to display fairly long text strings. Rather than trying to do that on the fly I precalculated how the text would have to be split and stored it as arrays of byte[] each sized right to be displayed on one line. This saved space by not storing unicode Strings and time by not calculating on the fly.
Bill
 
Rishi Tyagi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William,
But still there are some problems while implementing the same, Now i want to ask some more question:-
1- Should i convert the whole string into byte code first and then put it into the program?
If yes then is it not a very tedious method as i have to store more then 300 strings for comparison while showing the results, converting the whole data to byte code and then putting it into the program will be a tedious task.
2- If the above is not true means you want to say that i should first make a string variable and then convert it into byte array then as i think again i have to write the more number of linein my code, and i think it will again increase the size of the application at persistant storage.
Could you please give some small example to do the same so that it will be easy to understand and implement your suggesion.
Rishi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic