Forums Register Login

Most heavy guy in j2me

+Pie Number of slices to send: Send
Hi guys, I'm weak in j2me and I've tried to create my first application and I've faced with a issue, it's not really a issue it's more like a question, anyway, I'd would to know, what is the most heavy class(interface implemented) in j2me classes? such a Ticker or Alert, I don't know. so please help me out with this issue. thanks
+Pie Number of slices to send: Send
What do you mean by the most heavy ? The most used class ? If you use high level GUI, i think it's Form, if you use low level GUI then Canvas. Or actually, i think CommandListener is the most used class.

Post any questions here, i will answer them if i can.
+Pie Number of slices to send: Send
Hi Alex. I mean which object (component) is used most memory usage?
+Pie Number of slices to send: Send
It might not seem clear, but actually String is using up the most memory.

For example, creating Strings like this:

is very bad practice. When using very long Strings, you might encounter problems.
Strings should be created like this:

You don't really have to worry about memory so much. Using large Images or doing complex operations (like constructing an Image from pixel data) is the only thing you should be carefull with.

You can always read how much memory you have by using:


Hope this helps !
Alex
+Pie Number of slices to send: Send
 

Alex Parvan wrote:
For example, creating Strings like this:

is very bad practice.



Compile it, then decompile it with jad. You will be surprised...
+Pie Number of slices to send: Send
 

Lorand Komaromi wrote:Compile it, then decompile it with jad. You will be surprised...


I know it as a fact (search StringBuffer). Strings are immutable, every time you use one, memory is allocated, while StringBuffer can change it's value, therefore you avoid creating multiple temporary Strings.
+Pie Number of slices to send: Send
In Java SE the compiler will optimize the string concatenation to use StringBuilder. In ME this could be different, though...
+Pie Number of slices to send: Send
From my experience on J2ME Game development, getGraphics(); is the most heaviest thing.
+Pie Number of slices to send: Send
 

Srinath Gamage wrote:From my experience on J2ME Game development, getGraphics(); is the most heaviest thing.


Well yes, but you never expect some concatenations to give you an OutOfMemoryException It's true they have to be really long.
Slime does not pay. Always keep your tiny ad dry.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1466 times.
Similar Threads
Tomcat and Java ME
Get the currently executing method name w/ getName()
J2ME @ JavaRanch
new to j2me ..... please help !
Custom JSP Complier in Tomcat 6 ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:28:23.