Skip to main content

WINCE501bException

95 replies [Last post]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mkant
Offline
Joined: 2010-02-03

Independent from the Memory the WINCE501Exception comes after work with the app a few minutes.

What does it mean? I do not understnad this exception.

davyp
Offline
Joined: 2007-01-03

Based on what I found elsewhere a WINCE501bException usually means that an out-of-memory
has occurred.

http://social.msdn.microsoft.com/Forums/en-US/netfxcompact/thread/530c30...

http://social.msdn.microsoft.com/Forums/en-US/sqlce/thread/04afe059-095e...

For phoneME, it means an error in the native part of the VM (rather than in the Java heap space).
If I can fix the native widget's memory release issue, it might solve this problem as well. My gut
feeling tells me there is somewhere in the native peer implement a reference to certain AWT
objects not explicitly being released and this may explain why you run out of memory as the
garbage collector cannot clean up all the objects.

Bear with me a little longer. I am doing my best to fix it as soon as possible.

Regards,
Davy

mkant
Offline
Joined: 2010-02-03

Hello Davy,

do you know the exit code for thes exceptions?

It must be a value below 0, or?

Thank you.

Best regards,

Mathias

mkant
Offline
Joined: 2010-02-03

Hello Davy,

any news to the problem?

Thank you.

Best regards,

Mathias

davyp
Offline
Joined: 2007-01-03

No.

I had other things to do this weekend. Furthermore, I will be abroad this week, so it's quite likely it
won't be fixed in the next couple of days either. Sorry :-(

Like I said last Friday, I only work on this in my limited spare time (if I feel like it). Unfortunately for
you, my day job has priority as it allows me to pay my bills. I hope you understand.

Regards,
Davy

mkant
Offline
Joined: 2010-02-03

Hello Davy,

Our tester reported that the app suddenly exited without any exception.
The memory was by 6 MB.

Do you hear about such a problem?

Thank you.

Best regards,

Mathias

Message was edited by: mkant

davyp
Offline
Joined: 2007-01-03

That is correct. Your application probably has disabled the window title, and therefore it is not
listed. Just see what happens if you close the Java console and see if the other window disappears
too. Then check if the OS has reclaimed the memory in Settings -> Memory.

Davy

mkant
Offline
Joined: 2010-02-03

The other window doesn't disappears.
In Settings memory only stands data memory and program memory.

davyp
Offline
Joined: 2007-01-03

Annoying. Try to close it (or really kill it rather than pushing it into the background) with a free utility
like

MaggicButton: http://www.trancreative.com/WindowsPhone/MagicButton/
pBar: http://www.freewarepocketpc.net/ppc-download-pbar.html

Some Windows Mobile editions come with a task killer out of the box.

Davy

mkant
Offline
Joined: 2010-02-03

I need a solution for this, because the memory leak is a blocker bug for my application.

davyp
Offline
Joined: 2007-01-03

I understand your concern, and that you would like to have it fixed as soon as possible. However, I
am not an Oracle employee and I only work on the WinCE port of phoneME in my spare time (and
it's free software as in speech and beer after all). So I cannot give you any promises when the
issue will be addressed.

Cheers,
Davy

mkant
Offline
Joined: 2010-02-03

I understand you, too.
I do not want to make pressure on you.

I want to say thank you for you help and work.

Best regards,

Mathias

Hinkmond Wong

On 10/1/2010 3:12 AM, phonemeadvanced@mobileandembedded.org wrote:
> ...
> I just ran your test application on linux, and printouts in the range of 1300K-1600K. When
> I push the button it increases to 15M-18M but then after a few iterations, it drops back again
> to the previous range.
>
> I also ran the application on the Windows Mobile 6 emulator, and indeed the memory usage does
> not decrease. It starts at 209K. If I push the button it goes up to about 14M. Memory does not
> decrease after waiting for a while, and after pushing the button again memory usage goes up to
> about 28M, 41M, 55MB. It then quites with an OutOfMemory exception:
>
> ...
>
> There might be an issue with releasing resources used by the native widgets when the Java
> objects are released. Unfortunately, I cannot investigate it more thoroughly right now, but I will
> look into it when time permits.

Hi Davy,

I agree with your assessment. Since as you point out you are using the
current phoneME Advanced trunk (aka MR2 trunk), your WinMobile builds
should have the shrinkable/growable heap feature in it already. But, as
your tests show (Linux vs. WinMobile), there is a difference in memory
usage and there is probably a native WinMobile UI widget or object being
retained in your Windows Mobile port even when the corresponding Java
objects are released.

If you need help trying to track that down let us know. You might want
to try the Application Verifier tool for Windows Mobile:

http://msdn.microsoft.com/en-us/library/aa934674.aspx

http://discovertheexperience.blogspot.com/2009/02/how-to-find-memory-lea...

Hopefully that might help ease the process.

Thanks,

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

mkant
Offline
Joined: 2010-02-03

But with the newiest version, the test programm does not collapse at 27 MB.
It collapsed with an OutOfMemoryException at 64MB.

davyp
Offline
Joined: 2007-01-03

Yes, the memory boundary issue when using -Xopt:useLargeMemoryArea=true has been fixed
recently, so you can now use -Xmx64m.

http://forums.java.net/jive/thread.jspa?threadID=65914&tstart=0

I just ran your test application on linux, and printouts in the range of 1300K-1600K. When
I push the button it increases to 15M-18M but then after a few iterations, it drops back again
to the previous range.

I also ran the application on the Windows Mobile 6 emulator, and indeed the memory usage does
not decrease. It starts at 209K. If I push the button it goes up to about 14M. Memory does not
decrease after waiting for a while, and after pushing the button again memory usage goes up to
about 28M, 41M, 55MB. It then quites with an OutOfMemory exception:

Exception occurred during event dispatching:
java.lang.OutOfMemoryError: [I
at java.awt.GridBagLayout.GetLayoutInfo(Compiled Method)(GridBagLayout.java:637)
at java.awt.GridBagLayout.ArrangeGrid(Compiled Method)(GridBagLayout.java:1099)
at java.awt.GridBagLayout.layoutContainer(Compiled Method)(GridBagLayout.java:541)
at java.awt.Container.layout(Compiled Method)(Container.java:472)
at java.awt.Container.doLayout(Compiled Method)(Container.java:462)
at java.awt.Container.validateTree(Compiled Method)(Container.java:533)
at java.awt.Container.validateTree(Compiled Method)(Container.java:535)
at java.awt.Container.validate(Compiled Method)(Container.java:515)
at java.awt.CardLayout.show(Compiled Method)(CardLayout.java:551)
at TestFrame2$1.actionPerformed(Compiled Method)(TestFrame2.java:61)
at java.awt.Button.processActionEvent(Button.java:284)
at java.awt.Button.processEvent(Button.java:257)
at java.awt.Component.dispatchEventImpl(Component.java:2133)
at java.awt.Component.dispatchEvent(Component.java:1929)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:316)
at java.awt.EventQueueProxy.dispatchEvent(EventDispatchThread.java:325)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:127)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:122)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:113)
at java.lang.Thread.startup(Thread.java:785)

There might be an issue with releasing resources used by the native widgets when the Java
objects are released. Unfortunately, I cannot investigate it more thoroughly right now, but I will
look into it when time permits.

Davy

davyp
Offline
Joined: 2007-01-03

Mathias.

I just noticed something odd and I would like to ask you whether you can something else for
me?

Soft reset your device, and run your application until you get the out of memory error. Make sure
you close the application.

You can see whether the phoneME VM is still running in Start -> Settings -> System ->
Memory -> Running Programs

In my case, after a soft reset I have about 74MB available. After running the application
and closing it, the above list of running programs is empty. All the other task managers like pBar
and MagicButton show no running programs either. However, the Main tab of the Memory
Settings shows only having 1.6 MB free memory after the phoneME VM has shut down. Either
it is still active, but all WinCE windows are gone and therefore it is not visible anymore in the
above lists, or something fishy is going on.

Weird error indeed.

Davy

mkant
Offline
Joined: 2010-02-03

I do not see the test application (even if it is running) in the running programs.
I see only the Java console.

Message was edited by: mkant

mkant
Offline
Joined: 2010-02-03

When this problem stay in the runtime I have another question:

How is it possible to restart the application?
I tried this:
String command;
String command2;

command = "-Dsun.java2d.pmoffscreen=true " +
"-Djava.library.path=/mobileforms/lib " +
"-Xopt:useLargeMemoryArea=true " +
"-Xmx64M " +
"-Duser.language=de " +
"-Duser.country=DE " +
"-cp \"/mobileforms/MobileForms.jar\" de.igosys.mobileforms.MobileForms";

command2 = "\"/Programme/pMEA PP/bin/cvm.exe\"";

ProcessUtils.startOrForeground("title", command2, command);
System.exit(0);

And how is it possible to restart the windows mobile?

Thank you.

Best regards,

Mathias

Message was edited by: mkant

davyp
Offline
Joined: 2007-01-03

You definitely do not want to start a VM within another VM. On some WinCE platforms, lauching the same application twice will actually not work (it will just activate the first one).

Soft resetting a device to restart Windows Mobile is usually done by pressing a special button with
your stylus. It is very device specific

Davy

mkant
Offline
Joined: 2010-02-03

I want the soft reset by a java command.
The soft reset with the stylus I know.

Thanks.

Best regards,

Mathias

davyp
Offline
Joined: 2007-01-03

There is no J2ME API for that. You will have to provide it with a native library in C/C++
and call it through JNI

#define POWER_STATE_RESET 0x00800000;

SetSystemPowerState(NULL, POWER_STATE_RESET, 0);

Davy

Hinkmond Wong

On 9/30/2010 6:11 AM, phonemeadvanced@mobileandembedded.org wrote:
> Here is a very simple example:
>
> When I run the TestFrame2 in Windows and on the mobile device the ChangeFrame2 classes were finalized.
> But on the mobile device the memory raise and raise, and on the windows system it falls after each round to the base memory value.
> On the mobile device comes a OutOfMemoryException at 29 MB.

Hi Mathias,

Thanks for posting the testcase. This does look like a problem that you
would see in MR2, since the growable/shrinkable heap was first
introduced in MR3, not MR2.

Are you downloading the build that you run on Windows Mobile that
exhibits this problem from Davy Preuveneers' Web site? If so, which
exact build are you using?

Thanks,
Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

Hinkmond Wong

Sorry, Chris pointed out I keep mixing up MR3 with the current trunk
of phoneME Advanced. MR2 was never released, so the problem with no
growable/shrinkable heap is in actually in older releases of MR2, while
the addition of the growable/shrinkable heap as a new feature was added
in the most recent trunk of phoneME Advanced (which technically is still
MR2).

Hinkmond

On 9/30/2010 4:23 PM, Hinkmond Wong wrote:
> On 9/30/2010 6:11 AM, phonemeadvanced@mobileandembedded.org wrote:
>> Here is a very simple example:
>>
>> When I run the TestFrame2 in Windows and on the mobile device the
>> ChangeFrame2 classes were finalized.
>> But on the mobile device the memory raise and raise, and on the
>> windows system it falls after each round to the base memory value.
>> On the mobile device comes a OutOfMemoryException at 29 MB.
>
> Hi Mathias,
>
> Thanks for posting the testcase. This does look like a problem that
> you would see in MR2, since the growable/shrinkable heap was first
> introduced in MR3, not MR2.
>
> Are you downloading the build that you run on Windows Mobile that
> exhibits this problem from Davy Preuveneers' Web site? If so, which
> exact build are you using?
>
>
> Thanks,
> Hinkmond
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

Hinkmond Wong

On 9/30/2010 12:29 AM, phonemeadvanced@mobileandembedded.org wrote:
> Can I use a MR3 runtime?
> Where can I get this?
>

Hi Davy,

Are you using MR2 in your builds that you make available for WinMobile?
Or do you take what we have in the current trunk (which is MR3)?

Thanks,
Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

mkant
Offline
Joined: 2010-02-03

Here is a very simple example:

When I run the TestFrame2 in Windows and on the mobile device the ChangeFrame2 classes were finalized.
But on the mobile device the memory raise and raise, and on the windows system it falls after each round to the base memory value.
On the mobile device comes a OutOfMemoryException at 29 MB.

import java.awt.CardLayout;
import java.awt.Frame;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

public class TestFrame2 {

List frames;
CardLayout layout = new CardLayout();
Frame frame;

public static void main (String args[]) {
new TestFrame2();
}

public TestFrame2() {
TestFrame2.updateTimer();
this.frame = new Frame();
this.frame.setLayout(this.layout);

this.frames = new ArrayList();
for (int i = 0; i < 1000; i++) {
this.frames.add(new ChangeFrame2(i));
}

this.frame.add((Panel)
(((ChangeFrame2)TestFrame2.this.frames.get(0)).getPanel()),
String.valueOf(0));

((ChangeFrame2)this.frames.get(0)).getButton().
addActionListener(new ActionListener()
{

public void actionPerformed(ActionEvent _e) {

/* for the multiple use */
if (TestFrame2.this.frames == null) {
TestFrame2.this.frames = new ArrayList();
for (int i = 0; i < 1000; i++) {
TestFrame2.this.frames.add(new ChangeFrame2(i));
}
}

/* add each button in the panel an actionlistener
* and show the panel
* and delete the previous panel from the layout (frame) */
for (int i = 0; i < TestFrame2.this.frames.size(); i++) {
((ChangeFrame2)TestFrame2.this.frames.get(i)).getPanel();
((ChangeFrame2)TestFrame2.this.frames.get(i)).getButton().
addActionListener(this);

TestFrame2.this.frame.add((Panel)
(((ChangeFrame2)TestFrame2.this.frames.get(i)).getPanel()),
String.valueOf(i));

TestFrame2.this.layout.show(TestFrame2.this.frame, String.valueOf(i));

if (i != 0) {
TestFrame2.this.frame.remove((Panel)
(((ChangeFrame2)TestFrame2.this.frames.get(i-1)).getPanel()));
}
}
System.out.println((Runtime.getRuntime().totalMemory() >> 10) -
(Runtime.getRuntime().freeMemory() >> 10));

/* invalidate, dispose and set each panel to null */
for (int x = 1; x < TestFrame2.this.frames.size()-1; x++) {
ChangeFrame2 cf;
cf = ((ChangeFrame2)TestFrame2.this.frames.get(x));
cf.getButton().removeActionListener(this);
cf.dispose();
cf.invalidate();
cf = null;
}
/* clear the list of panels */
TestFrame2.this.frames.clear();
TestFrame2.this.frames = null;

System.gc();

System.out.println((Runtime.getRuntime().totalMemory() >> 10) -
(Runtime.getRuntime().freeMemory() >> 10));
}
});
TestFrame2.this.frame.setSize(200,200);
TestFrame2.this.frame.setVisible(true);
TestFrame2.this.layout.show(TestFrame2.this.frame, String.valueOf(0));

}

/**
* updateTimer to log the memory.
*/
public static void updateTimer() {
Timer timer;
TimerTask task;

timer = new Timer();
task = new TimerTask() {
public void run() {
System.gc();
System.out.println((Runtime.getRuntime().totalMemory() >> 10) -
(Runtime.getRuntime().freeMemory() >> 10));

}
};

timer.schedule(task, 2000, 10000);
}
}

import java.awt.Button;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Label;
import java.awt.Panel;

public class ChangeFrame2 {

public static int count = 0;
public int i;
private Button button;
private Panel panel;

public ChangeFrame2(int _i) {
i = _i;
}

public Button getButton() {
return this.button;
}

public Panel getPanel() {
if (this.panel == null) {
this.panel = new Panel(new GridBagLayout());
this.initializeUI(this.panel);
}
return this.panel;
}

protected void finalize() throws Throwable {
System.out.println("FINALIZE" + count);
count++;
super.finalize();
}

/**
*
*/
public void dispose() {
this.getPanel().removeAll();
this.button = null;
}

protected void initializeUI(Container _frame) {
GridBagConstraints gbc;
Label label;

gbc = new GridBagConstraints();
this.button = new Button("sdsd");

label = new Label("dfdsfd");

_frame.setLayout(new GridBagLayout());
_frame.add(this.button, gbc);
_frame.add(label, gbc);
_frame.add(label, gbc);
_frame.setSize(200, 200);
_frame.setVisible(true);

}

public void invalidate() {
this.button = null;
this.getPanel().removeAll();
}
}

davyp
Offline
Joined: 2007-01-03

On Friday, October 01, 2010, Hinkmond Wong wrote:
> On 9/30/2010 6:11 AM, phonemeadvanced@mobileandembedded.org wrote:
> > Here is a very simple example:
> >
> > When I run the TestFrame2 in Windows and on the mobile device the
> > ChangeFrame2 classes were finalized. But on the mobile device the memory
> > raise and raise, and on the windows system it falls after each round to
> > the base memory value. On the mobile device comes a OutOfMemoryException
> > at 29 MB.
>
> Hi Mathias,
>
> Thanks for posting the testcase. This does look like a problem that you
> would see in MR2, since the growable/shrinkable heap was first
> introduced in MR3, not MR2.
>
> Are you downloading the build that you run on Windows Mobile that
> exhibits this problem from Davy Preuveneers' Web site? If so, which
> exact build are you using?
>
>
> Thanks,
> Hinkmond

Thanks for the example. If I have some spare time, I will look if I can reproduce the problem.

Cheers,
Davy

davyp
Offline
Joined: 2007-01-03

On Friday, October 01, 2010, Hinkmond Wong wrote:
> Sorry, Chris pointed out I keep mixing up MR3 with the current trunk
> of phoneME Advanced. MR2 was never released, so the problem with no
> growable/shrinkable heap is in actually in older releases of MR2, while
> the addition of the growable/shrinkable heap as a new feature was added
> in the most recent trunk of phoneME Advanced (which technically is still
> MR2).
>
> Hinkmond

Well now you got me confused as well. As far as I know the MR2 is actually available
over here:

https://phoneme.dev.java.net/downloads_page.html

And if you look at subversion trunk in cdc/builds/share/id_cdc.mk:

J2ME_PROFILE_NAME = CDC
J2ME_PROFILE_SPEC_VERSION = 1.1

CVM_BUILD_ID = b168
CVM_BUILD_NAME = CVM
CVM_BUILD_VERSION = phoneme_advanced_mr2

It seems to me that PhoneME Advanced MR3 was never publically released
or either the labels in svn are wrong?

Cheers,
Davy

mkant
Offline
Joined: 2010-02-03

I' m very confused about these posts.

What does it mean to me?
I use the build:
Personal_Profile-phoneme_advanced_mr2_b151-win32arm_wm6-bin-rev20286.cab

But I tried the newest build of that and it doesn' t work, too.

Thanks.

Best regards,

Mathias

mkant
Offline
Joined: 2010-02-03

And a very interesting question for me is:
Why collapsed the runtime at 27MB. I gave it 64MB with -Xmx parameter.

Are there settings for that?

Thank you.

Best regards,

Mathias

mkant
Offline
Joined: 2010-02-03

The problem is that, the GC only finalize these panels which I had not shown.
-have a list of panels
-have a mainframe
-panels were shown on the mainframe
-panels are in Default not initilized (no UI) -- > only constructor
-when they are visible the UI were build
--> these shown panels doesn't finalize

Hinkmond Wong

On 9/27/2010 5:31 AM, phonemeadvanced@mobileandembedded.org wrote:
> The problem is that, the GC only finalize these panels which I had not shown.
> -have a list of panels
> -have a mainframe
> -panels were shown on the mainframe
> -panels are in Default not initilized (no UI) --> only constructor
> -when they are visible the UI were build
> --> these shown panels doesn't finalize

Hi Mathias,

Can you please write a short Java program that exhibits the same
behavior as you are seeing in your bigger app, then post it here to this
forum? It will help to see the actual Java source code that
demonstrates the object retention problem, but in a simple testcase, not
your full app. Otherwise, it is too difficult to try to assess your
problem by just your description.

In general to fix a problem like this, you should not adjust the garbage
collection parameters, but instead it is usually either an AWT porting
layer problem (such as in the Windows Mobile porting layer of Personal
Profile), or it is a programming technique error in your app source
code, which on mobile devices will behave differently than on a desktop PC.

Thanks,
Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

davyp
Offline
Joined: 2007-01-03

Yes, an example application with which we can reproduce the problem would definitely help.

Perhaps some GUI objects cannot be garbage collected because the corresponding native
counterparts are still alive. But even in that case, you should get a Java out-of-memory exception
and not a WinCE501b exception.

Davy

mkant
Offline
Joined: 2010-02-03

Now I have fixed it.

The GC finalize the panels.

BUT the used memory (total - free memory) does not fall.

It finalize a lot of classes but the used memory does not change.

What could it be?

Have you an example where the used memory fall?

I hope anyone can give me a tip without code.

Thank you,

Best regards,

Mathias

Hinkmond Wong

On 9/29/2010 8:54 AM, phonemeadvanced@mobileandembedded.org wrote:
> Now I have fixed it.
>
> The GC finalize the panels.
>
> BUT the used memory (total - free memory) does not fall.
>
> It finalize a lot of classes but the used memory does not change.
>
> What could it be?
>
> Have you an example where the used memory fall?
>
> I hope anyone can give me a tip without code.

Hi Mathias,

I believe the issue is that you are assuming that the CVM has a
"shrinkable heap" (dynamic memory shrinks during execution after proper
GC happens).

You need a CVM engineer on this list to confirm, but I believe that is
not a correct assumption if your are using phoneME Advanced MR2 (which
is probably the port you are currently using on WinMobile from Davy).

Chris, is that the issue? I believe a "shrinkable heap" in CVM was
introduced only in MR3, not MR2, so Mathias doesn't see the dynamic
memory usage fall after his proper GC.

Thanks,
Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

mkant
Offline
Joined: 2010-02-03

But I do not want that the total memory fall.
I mean the totalMemory - freeMemory from the Runtime.
This value should sink after finalizing.

Can I use a MR3 runtime?
Where can I get this?

Message was edited by: mkant

davyp
Offline
Joined: 2007-01-03

It seems a couple of posts of Hinkmond have not arrived yet on the forum. I will reply inline:

On Friday, October 01, 2010, Hinkmond Wong wrote:
> On 9/30/2010 12:29 AM, phonemeadvanced@mobileandembedded.org wrote:
> > Can I use a MR3 runtime?
> > Where can I get this?
>
> Hi Davy,
>
> Are you using MR2 in your builds that you make available for WinMobile?
> Or do you take what we have in the current trunk (which is MR3)?
>
>
> Thanks,
> Hinkmond

I am building from the latest version in trunk. Not sure if it is MR2 or MR3. If the label is
wrong that is my bad.

Davy

mkant
Offline
Joined: 2010-02-03

With which parameters at the call of the app, I can manipulate the perforamnce of the app and the garbage collector?

-XXUseParallelGC doesn# t work with phoneme.

This is a big problem for me. Has anybody memory hints for me?

Thank you.

Best regards,

Mathias

mkant
Offline
Joined: 2010-02-03

I have write a little test program.

One with 2 panel, that are switching 100 times.
After each the old is set to null and invalidate.
Beore showing a new is created.
--> this works on the mobile device. It get finalized.

Another with a list of panels.
Each panel is shown in a for loop.
after this I invalidate and set the panels null and invalidate them.
After that I set the list to null.
--> the application doesn´t finalize the panels

Message was edited by: mkant

Message was edited by: mkant

Hinkmond Wong

On 9/24/2010 8:34 AM, phonemeadvanced@mobileandembedded.org wrote:
> I have write a little test program.
>
> One with 2 panel, that are changing 100 times.
> After each the old is set to null and invalidate.
> --> this works on the mobile device. It get finalized.
>
> Another with a list of panels.
> Each panel is shown in a for loop.
> after this I invalidate and set the panels null and invalidate them.
> After that I set the list to null.
> --> the application doesn´t finalize the panels

Hi Mathias,

When you say the app doesn't "finalize the panels", how are you checking
that? What does your code look like? Also, are you sure you are also
setting the children components of the panels to null before setting
each panel to null?

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

mkant
Offline
Joined: 2010-02-03

Hello,

I ovrride the finalize method of the class.

In my main app, a lot of class were finalized.
But when I check the memory the used memory (total - free memory) does not fall.

The same application as normal Java application gives the memory back and the used
memory fall after finalizing the classes.

Can anybody help me?

And why collapsed my app with a total memory of 29 MB?
The mobile device has 128 MB RAM and I give 64MB to the app (-Xmx64M)

Thank you.

Best regards,

Mathias

mkant
Offline
Joined: 2010-02-03

For more Information:

Personal_Profile-phoneme_advanced_mr2_b151-win32arm_wm6-bin-rev20286.cab

I use following call:

#"\Programme\pMEA PP\bin\cvm.exe" -Dsun.java2d.pmoffscreen=false -Djava.library.path=\mobileforms\lib -Xopt:useLargeMemoryArea=true -Xmx64M -Duser.language=de -Duser.country=DE -cp "\mobileforms\MobileForms.jar" de.igosys.mobileforms.MobileForms

I tested it yesterday with this memory at the end before the app collapsed (can be another exception - the whole mobile device is down)
Speicher: TOT: 27364 kByte(0) FREE: 154 kByte(0), MAX: 65536 kByte(0), USED: 27210 kByte

It is strange, beacuse I give 64MB to the app, and it collapsed at 27MB.

Can you help me?

Thanks.

Best regards,

Mathias

Message was edited by: mkant

mkant
Offline
Joined: 2010-02-03

Can it be that the garbage collector is different to a windows java app?

mkant
Offline
Joined: 2010-02-03

It seems to be a memory problem.
I can´t reducing the memory. It raise and raise but even if I dispose, invalidate or anything else
the memory doesn´t fall.

Thank you.

Best regards,

Mathias

davyp
Offline
Joined: 2007-01-03

Hi Mathias,

WINCE501bException is usually a difficult error to debug. What type of device are you using?
Which WinCE / Windows Mobile OS version and which phoneME build? Have you tried running
the code in the MS device emulator? Do you have some code with which I can reproduce the
error? Otherwise it is a bit difficult to pin down the cause.

Regards,
Davy

mkant
Offline
Joined: 2010-02-03

I have the HP ipaq 214, WindowsMobile 6.

Code is difficult, because it comes on different places (I think when the memory is full)

When I let me print the memory facts I see, that the Runtime doesn´t give the memory back, when the Objects are finalized.

Have you an hint for me?

Thank you.

Best regards,

Mathias