Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of memory at PeekAndPop.initialiseViewTreeObserver #13

Open
JitenNumberTank opened this issue May 17, 2016 · 12 comments
Open

Out of memory at PeekAndPop.initialiseViewTreeObserver #13

JitenNumberTank opened this issue May 17, 2016 · 12 comments

Comments

@JitenNumberTank
Copy link

Hello shalskar,

I am getting this issue while scrolling listview. I have set peekand pop general listener on long click image of adapter view.

heap: Out of memory on a 9540-byte allocation.
05-17 09:33:27.836 877-877/com.numberatank I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
05-17 09:33:27.836 877-877/com.numberatank I/dalvikvm: | group="main" sCount=0 dsCount=0 obj=0xa62d44b0 self=0xb7bca510
05-17 09:33:27.836 877-877/com.numberatank I/dalvikvm: | sysTid=877 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=-1216674752
05-17 09:33:27.836 877-877/com.numberatank I/dalvikvm: | schedstat=( 7305323441 1221308445 25267 ) utm=586 stm=143 core=0
05-17 09:33:27.836 877-877/com.numberatank I/dalvikvm: at java.util.concurrent.CopyOnWriteArrayList.add(CopyOnWriteArrayList.java:~267)
05-17 09:33:27.856 877-877/com.numberatank I/dalvikvm: at android.view.ViewTreeObserver.addOnGlobalLayoutListener(ViewTreeObserver.java:369)
05-17 09:33:27.856 877-877/com.numberatank I/dalvikvm: at com.numberatank.peekandpop.PeekAndPop.initialiseViewTreeObserver(PeekAndPop.java:168)
05-17 09:33:27.856 877-877/com.numberatank I/dalvikvm: at com.numberatank.peekandpop.PeekAndPop.initialisePeekView(PeekAndPop.java:145)
05-17 09:33:27.856 877-877/com.numberatank I/dalvikvm: at com.numberatank.peekandpop.PeekAndPop.init(PeekAndPop.java:111)
05-17 09:33:27.856 877-877/com.numberatank I/dalvikvm: at com.numberatank.peekandpop.PeekAndPop.(PeekAndPop.java:88)
05-17 09:33:27.856 877-877/com.numberatank I/dalvikvm: at com.numberatank.peekandpop.PeekAndPop$Builder.build(PeekAndPop.java:675)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at com.numberatank.adapter.ChannelChatAdapter.getView(ChannelChatAdapter.java:429)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.widget.AbsListView.obtainView(AbsListView.java:2251)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.widget.ListView.makeAndAddView(ListView.java:1769)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.widget.ListView.fillDown(ListView.java:672)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.widget.ListView.fillGap(ListView.java:636)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5036)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3193)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.widget.AbsListView.onTouchEvent(AbsListView.java:3467)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.View.dispatchTouchEvent(View.java:7127)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2170)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1925)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1379)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.app.Activity.dispatchTouchEvent(Activity.java:2396)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1873)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.View.dispatchPointerEvent(View.java:7307)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3172)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3117)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4153)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4132)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4224)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4203)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4243)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.Choreographer.doCallbacks(Choreographer.java:555)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.Choreographer.doFrame(Choreographer.java:523)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.os.Handler.handleCallback(Handler.java:615)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.os.Handler.dispatchMessage(Handler.java:92)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.os.Looper.loop(Looper.java:137)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at android.app.ActivityThread.main(ActivityThread.java:4745)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at java.lang.reflect.Method.invokeNative(Native Method)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at java.lang.reflect.Method.invoke(Method.java:511)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-17 09:33:27.868 877-877/com.numberatank I/dalvikvm: at dalvik.system.NativeStart.main(Native Method)

@shalskar
Copy link
Owner

Hmmm, I'm not sure if this OOM is being caused by the PeekAndPop library, however if you have your code here on Github I can pull it down and check it out if you'd like?

@JitenNumberTank
Copy link
Author

I am working on product so douldn't share project but I am sharing peekand
pop uses code here. I have used this code in my adapter

final PeekAndPop peekAndPop = new PeekAndPop.Builder(fragment.getActivity())
.blurBackground(true)
.peekLayout(R.layout.peek_view)

.parentViewGroupToDisallowTouchEvents(channelListview)
.build();

            peekAndPop.addLongClickView(viewHolder.imageView, position);

            peekAndPop.setOnGeneralActionListener(new

PeekAndPop.OnGeneralActionListener() {
@OverRide
public void onPeek(View longClickView, int position) {
LogUtils.e("", "onPeek::");

                    final ImageView imageView = (ImageView)

peekAndPop.getPeekView().findViewById(R.id.imageView);
final ProgressWheel progressWheel = (ProgressWheel)
peekAndPop.getPeekView().findViewById(R.id.progress_wheel);
if (!TextUtils.isEmpty(imgChannelid) &&
imgChannelid.equals(channelid)) {
Picasso.with(context)
.load(Uri.fromFile(new
File(context.getCacheDir(), "channelLarge")))
.into(imageView);
} else {
final String url = Constants.CHANNEL_IMAGE_URL

  • channelid + "/fs_" + img;
    // Utils.showWhiteProgressDialog(context);
    progressWheel.setVisibility(View.VISIBLE);
    Picasso.with(context)
    .load(url)
    .into(imageView, new
    com.squareup.picasso.Callback() {
    @OverRide
    public void onSuccess() {
    // Utils.closeProgressDialog();

progressWheel.setVisibility(View.GONE);
}

                                    @Override
                                    public void onError() {

// Utils.closeProgressDialog();

progressWheel.setVisibility(View.GONE);
Picasso.with(context)
.load(url)

.placeholder(R.drawable.profilepic)
.into(imageView);
}
});
}
}

                @Override
                public void onPop(View longClickView, int position) {
                    LogUtils.e("", "onPop::");
                }


            });
        }

On Wed, May 18, 2016 at 12:13 PM, Vincent Te Tau [email protected]
wrote:

Hmmm, I'm not sure if this OOM is being caused by the PeekAndPop library,
however if you have your code here on Github I can pull it down and check
it out if you'd like?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#13 (comment)

       Thanks & Regards,

*Jiten Ramoliya *

@shalskar
Copy link
Owner

How large are your image files? I would suspect your problem lies there and not with the PeekAndPop library.

@JitenNumberTank
Copy link
Author

My image size is 11kb. 12-15 images available in adapter

On Wed, May 18, 2016 at 12:38 PM, Vincent Te Tau [email protected]
wrote:

How large are your image files? I would suspect your problem lies there
and not with the PeekAndPop library.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#13 (comment)

       Thanks & Regards,

*Jiten Ramoliya *

@shalskar
Copy link
Owner

Strange, those images don't seem to be terribly large. Does this crash occur consistently at the same point? It might pay to do a memory heap dump before it crashes to see where your memory is allocated.

@JitenNumberTank
Copy link
Author

Yes Its occuring every time from same point. Its always come from PeekAndPop.initialiseViewTreeObserver

@JitenNumberTank
Copy link
Author

Yes, It crash from same point.

On Wed, May 18, 2016 at 12:45 PM, Vincent Te Tau [email protected]
wrote:

Strange, those images don't seem to be terribly large. Does this crash
occur consistently at the same point? It might pay to do a memory heap dump
before it crashes to see where your memory is allocated.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#13 (comment)

       Thanks & Regards,

*Jiten Ramoliya *

@shalskar
Copy link
Owner

I'm still not sure if the library is causing this OOM. It's probable that you have a memory leak somewhere and that the library is simply the hitting the limit of memory by coincidence. I will have a look into it but it may be quite hard to replicate it without a bit more background as to what's happening in your app.

It might pay to have a look at your allocated memory before clicking on the peek view.

@JitenNumberTank
Copy link
Author

Ok, Let me check. I will know you

On Sat, May 21, 2016 at 4:40 PM, Vincent Te Tau [email protected]
wrote:

I'm still not sure if the library is causing this OOM. It's probable that
you have a memory leak somewhere and that the library is simply the hitting
the limit of memory by coincidence. I will have a look into it but it may
be quite hard to replicate it without a bit more background as to what's
happening in your app.

It might pay to have a look at your allocated memory before clicking on
the peek view.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#13 (comment)

       Thanks & Regards,

*Jiten Ramoliya *

@JitenNumberTank
Copy link
Author

How can I check alloacated memory before before clicking.

@shalskar
Copy link
Owner

shalskar commented Jun 3, 2016

I'm assuming you're using Android Studio, in the android panel (where logcat is located), click on memory tab. This will show you a graph of memory allocation in your app, to the left there is an icon called "Dump Java Heap" which allows you to get a snapshot of memory allocation at that particular point.

In this snapshot you should be able to see where where exactly your memory is allocated and what may be causing the OOM.

@JitenNumberTank
Copy link
Author

I have checked this issue. but getting this issue still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants