[android-developers] Re: memory problems

2009-04-22 Thread fadden
On Apr 20, 1:17 pm, JP joachim.pfeif...@gmail.com wrote: Sure, however... if memory is released each time within the few calls (as OP describes), the program might get through with whatever it does. This assumes this function is not called in a loop or at a high rate generally speaking.

[android-developers] Re: memory problems

2009-04-20 Thread fadden
On Apr 17, 2:01 pm, petunio juanjosegilmen...@hotmail.com wrote: static void test(int k) {         byte [] buff = new byte[k];         //do some stuff with  buff[]         buff=null; } You shouldn't need to set buff to null. When the function returns the locals go out of scope and

[android-developers] Re: memory problems

2009-04-20 Thread fadden
On Apr 18, 11:31 am, JP joachim.pfeif...@gmail.com wrote: You may get this resolved by calling the garbage collector right there; system.gc() after you dereference the byte array with buff=null; The garbage collector will produce the same result whether it's called explicitly or the VM

[android-developers] Re: memory problems

2009-04-20 Thread JP
On Apr 20, 11:08 am, fadden fad...@android.com wrote: On Apr 18, 11:31 am, JP joachim.pfeif...@gmail.com wrote: You may get this resolved by calling the garbage collector right there; system.gc() after you dereference the byte array with buff=null; The garbage collector will produce

[android-developers] Re: memory problems

2009-04-18 Thread Carl Whalley
Try running that in DDMS and watching how often the GC is called. -- Android Academy: http://www.androidacademy.com On Apr 17, 10:01 pm, petunio juanjosegilmen...@hotmail.com wrote: Hi I know this is more a java question, but I have been in many java forums, and the theory seems to

[android-developers] Re: memory problems

2009-04-18 Thread JP
You may get this resolved by calling the garbage collector right there; system.gc() after you dereference the byte array with buff=null; On Apr 17, 2:01 pm, petunio juanjosegilmen...@hotmail.com wrote: Hi I know this is more a java question, but I have been in many java forums, and the

[android-developers] Re: memory problems

2009-04-18 Thread Dianne Hackborn
You really should not be forcing the garbage collector to run like this, and there should be no need to do so. On Sat, Apr 18, 2009 at 11:31 AM, JP joachim.pfeif...@gmail.com wrote: You may get this resolved by calling the garbage collector right there; system.gc() after you dereference the

[android-developers] Re: memory problems

2009-04-17 Thread Dianne Hackborn
The garbage collector will take care of freeing it, unless there is something else holding a reference to it (for example inside of your do stuff part). You don't need to set buff to null at the end, either. On Fri, Apr 17, 2009 at 2:01 PM, petunio juanjosegilmen...@hotmail.comwrote: Hi I