OutOfMemory problem

by Kofa » Sun, 18 Apr 2010 17:50:22 GMT


Sponsored Links
 I really don't know why it's giving me this error...
I load an ImageView with an image of 692kb .jpg, using scroll options,
so you can scroll it around... the strange it's that when the mobile
it's connected to the VM it's less possible to happen.
So...how can I prevent this? is there anyway that I can free memory
when starting the app? can I tell the system to free memory before
loading the image? please show me the path =P....thx a lot!

--



OutOfMemory problem

by Streets Of Boston » Sun, 18 Apr 2010 23:59:28 GMT


 How big, in pixels, is the image?



>


Sponsored Links


OutOfMemory problem

by patbenatar » Mon, 19 Apr 2010 17:36:16 GMT


 You say your error doesn't happen as often if you are plugged into
your computer? Is that what you mean by VM? If so, that's likely
because you're developing your code at the time and every time you run
it on the device it kills and restarts your process.. leaving little
time for memory leaks to lead to OutOfMemory errors. Just FYI.

As for your OutOfMemory errors, this can be a really tough one to
debug.. Your app is leaking memory somewhere, but its hard to say
where. The image is not necessarily the problem, it could simply be
the tipping point that finally forces your app to crash. I would
recommend reading over all the articles tagged "Optimization" over at
 http://android-developers.blogspot.com 

-Nick







> >



OutOfMemory problem

by Kofa » Thu, 22 Apr 2010 02:56:07 GMT


 I'm looking at this blog about Optimization, thanks patbenatar.
The image it's 1920x1440 pixels, hope it helps.

--



OutOfMemory problem

by Kofa » Thu, 22 Apr 2010 02:57:22 GMT


 the image it's 1920x1440 pixels




> >



OutOfMemory problem

by Streets Of Boston » Thu, 22 Apr 2010 03:41:21 GMT


 1920p * 1440p * 2Bytes/p = 2764800*2 = 5529600 Bytes per image.

That's a big chunk and only a one time leak could cause your memory
issue.
Track your code and see where you possibly cache the reference to this
large Bitmap.
Note that memory used by Bitmaps (the internal array of bytes) is not
part of the DalvikVM and won't show up when you do java memory
profiling. However, this memory is part of the overall memory used by
the app's process.






> > >



Other Threads

1. Breakpoint not getting hit in Interface function implemented in Service

Hi,

I'm trying to connect to a service from an Activity. I wrote an AIDL
file with functions that will be implemented in the Service. The
function onServiceConnected() is getting called.


private ServiceConnection mConnection = new ServiceConnection()
    {
               public void onServiceConnected(ComponentName className,
IBinder service) {
                        mpInterface = 
MytestInterface.Stub.asInterface((IBinder)service);
                        mpInterface.clearPlaylist(); ---> its breaks here (1)
                                                ........
               }
    }

Now when I try to step through the function clearPlayList(), it first
goes to the MytestInterface.java file which was auto-generated by
eclipse

public void clearPlaylist() throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_clearPlaylist, _data, _reply, 0); ---
_reply.readException();
}
finally {
_reply.recycle();
_data.recycle();
}

Now the actual implementation of this function is in Service class.
But the breakpoint never comes to this function.
Instead the control goes back to onServiceConnected() function.

Service class
=========
private final MytestInterface.Stub mBinder = new MytestInterface.Stub
() {

public void clearPlaylist() {
                        songs.clear();
                }
}

What could be the issue. Is there any error happening in
mRemote.transact() function.
--~--~---------~--~----~------------~-------~--~----~

2. Using Homemade TrueType Fonts In Android

To all:

I've noticed that Android lets developers include their own TrueType
fonts, by way of the assets\fonts folder.  This is a great feature,
and works well.

But I notice that if I copy one of my own homemade TrueType fonts -
created using CorelDraw's export function - any text I render in that
font comes out as the Android system default font rather than in the
font I've just included.

Is there something the Android environment looks for in TrueType or
*.TTF files - a digital signature, a certain character, something -
that would cause a homemade font file's outlines to be ignored?

The TTF files I've created only have a subset of the entire character
set, usually consisting only of numbers and symbols.  The TTF file
works just fine in major applications like Microsoft Office (even the
latest one) and Adobe Photoshop.  Can any of the Android developers
comment?

Thanks,
Charles


--~--~---------~--~----~------------~-------~--~----~

3. Is there really no possibility to detect incoming calls with a receiver?

4. error on my Mac 10.4 Power book: cannot execute binary file

5. why does the same code NOT work same in different scenarios? JNI issue, please help.

6. Anyone get a tracking number for the dev phone?

7. center the tablelayout