AndroidImageSlider icon indicating copy to clipboard operation
AndroidImageSlider copied to clipboard

memory leak

Open d7coders opened this issue 9 years ago • 7 comments

I have memory leak just by adding

<com.daimajia.slider.library.SliderLayout
    android:id="@+id/slider"
    android:layout_width="match_parent"
    android:layout_height="200dp"
/>

to view

d7coders avatar Oct 29 '15 01:10 d7coders

Any solution ?

BackPackerDz avatar Jan 26 '16 13:01 BackPackerDz

Have you guys done the following in your activity or fragment? @d7coders @BackPackerDz

@Override
    protected void onStop() {
        // To prevent a memory leak on rotation, make sure to call stopAutoCycle() on the slider before activity or fragment is destroyed
        mDemoSlider.stopAutoCycle();
        super.onStop();
    }

Can you provide some logs?

ericntd avatar Nov 15 '16 07:11 ericntd

Yes

On 15 Nov 2016 11:11 a.m., "Eric N" [email protected] wrote:

Have you guys done the following in your activity or fragment? @d7coders https://github.com/d7coders @BackPackerDz https://github.com/BackPackerDz

@Override protected void onStop() { // To prevent a memory leak on rotation, make sure to call stopAutoCycle() on the slider before activity or fragment is destroyed mDemoSlider.stopAutoCycle(); super.onStop(); }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/daimajia/AndroidImageSlider/issues/164#issuecomment-260569252, or mute the thread https://github.com/notifications/unsubscribe-auth/AEofasqoLvITHW5h2fxYQyX8DgNgi173ks5q-WIrgaJpZM4GX3Ys .

d7coders avatar Nov 15 '16 07:11 d7coders

+1 yes i got this issue. everytime sliding an image, the memory usage increased.

awidiyadew avatar Dec 12 '16 15:12 awidiyadew

Hi everyone I have same problem, everytime image sliding memory allocation increasing. I solved this issue by clean garbage collection, it seems to work :D

public class MainActivity extends AppCompatActivity 
implements 
BaseSliderView.OnSliderClickListener, ViewPagerEx.OnPageChangeListener
{
   // ......
    @Override
    public void onPageSelected(int position) {
        Runtime.getRuntime().gc();
        Log.d("Slider Demo", "Page Changed: " + position);
    }
}

awidiyadew avatar Dec 12 '16 16:12 awidiyadew

Hi, I have two tabs in my activity. I am changing the sliders of sliderview when the tab is changed.

this is my code `

 if (AppConstants.TAGNAME.FLOOR_PALN.getValue().contentEquals(planType)) {
        slider.removeAllSliders();
        for (FloorPlan floorPlan : mFloorPlan) {
            TextSliderView textSliderView = new TextSliderView(this);
            textSliderView
                    .description(floorPlan.getTitle())
                    .image(floorPlan.getFloorImg())
                    .setScaleType(BaseSliderView.ScaleType.Fit);
            textSliderView.bundle(new Bundle());
            textSliderView.getBundle()
                    .putString("extra", floorPlan.getTitle());
            slider.addSlider(textSliderView);
        }
    } else {
        slider.removeAllSliders();
        TextSliderView textSliderView = new TextSliderView(this);
        textSliderView
                .description(layout.getTitle())
                .image(layout.getMasterImg())
                .setScaleType(BaseSliderView.ScaleType.Fit);
        textSliderView.bundle(new Bundle());
        textSliderView.getBundle()
                .putString("extra", layout.getTitle());
        slider.addSlider(textSliderView);
    }`

i am comparing the string and removing the sliders, then adding the new sliders of the particular tab. But i am getting out of memory exception for this. Can any one tel me how to solve this?

HasanShaikh avatar May 25 '17 04:05 HasanShaikh

Have you guys done the following in your activity or fragment? @d7coders @BackPackerDz

@Override
    protected void onStop() {
        // To prevent a memory leak on rotation, make sure to call stopAutoCycle() on the slider before activity or fragment is destroyed
        mDemoSlider.stopAutoCycle();
        super.onStop();
    }

Can you provide some logs?

you saved my time,thanks

heronghua avatar Jun 28 '19 06:06 heronghua