dalvikvm-heap(16081): Grow heap (frag case) to 11.341MB for 460816-byte allocation

2,274 views
Skip to first unread message

learner

unread,
Mar 5, 2012, 5:58:58 AM3/5/12
to android-ndk
Hello All,

In my android application i am allocating 5 direct buffers as follows:

private ByteBuffer[] mBuffer;
//
mBuffer = new ByteBuffer[5];
for (int i = 0; i < 5; i++) {
mBuffer[i] = ByteBuffer.allocateDirect(mBufSize);//mBufSize would
be 460800 Bytes

}

And in another module of my app, i will get ByteBuffer from JNI (which
is allocated in JNI using NewDirectByteBuffer) and i will retrieve the
byte array from it in to an already allocated byte array like this:

public byte[] getBuffer()
{
Log.d("MyTest","Entered in to GetBuffer");
returnedBuffer = new byte[mValue.capacity()];//mValue is the
ByteBuffer returned to me from JNI and capacity is 460800

mValue.get(returnedBuffer);
return returnedBuffer;

}

But once the mValue.get statement is executed i am getting an
exception which says:

dalvikvm-heap(16081): Grow heap (frag case) to 11.341MB for 460816-
byte allocation.

I am not able to understand what is the reason for it. Is
allocateDirect call allocating the memory in heap space? Am i ran out
of heap memory?

How can i resolve this situation.

regards,

Sriram.

Narayan Kamath

unread,
Mar 5, 2012, 6:31:52 AM3/5/12
to andro...@googlegroups.com
What leads you to think this is an error message or exception ?  By itself
that is just an informational message. Are you seeing any other abnormal
behaviour ?


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.




--
_________________
Save Rainforests

learner

unread,
Mar 5, 2012, 6:43:37 AM3/5/12
to android-ndk
Hello Mr Narayan,

Immediately after this log, i get A/libc(18997): Fatal signal 11
(SIGSEGV) at 0x70787f80 (code=1) and during the debug process, i
observed that control is lost after "mValue.get(returnedBuffer);"
with the dump giving the above logs.

mValue is not null and returnedBuffer is allocated by me with mValue
size.

I dont know why my ByteBuffer.get() method is failing.

regards,

Sriram.

learner

unread,
Mar 6, 2012, 3:01:09 AM3/6/12
to android-ndk
Hi Narayan,

I found the mistake in my code. It nothing to do with direct buffer,
but i am trying to get an array from an invalid direct buffer. I
resolved the problem now.

Thanks for your help.

regards,

Sriram.
> > Save Rainforests- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages