Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7573321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:09:12+00:00 2026-05-30T16:09:12+00:00

If I comment this block out, then the GC spam goes away. What’s causing

  • 0

If I comment this block out, then the GC spam goes away. What’s causing the spam? If I comment out the section “// Cleanup” then the spam is still there.

public void updatePixels()
{
    // Fill the bitmap with black.
    mBitmap.eraseColor(Color.BLACK);

    // Pass bitmap to be rendered by native function.
    if(!mNativeHelper.render(mBitmap)) return;


    // If FroyVisuals has text to display, then use a canvas and paint brush to display it.
    String text = mActivity.mTextDisplay;
    if(text != null)
    {
        // Give the bitmap a canvas so we can draw on it.
        mCanvas.setBitmap(mBitmap);

        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setTextSize(10);
        paint.setTypeface(Typeface.create(Typeface.SERIF, Typeface.ITALIC));
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(1);
        paint.setColor(Color.WHITE);
        paint.setTextAlign(Paint.Align.CENTER);

        float canvasWidth = mCanvas.getWidth();
        float textWidth = paint.measureText(text);
        float startPositionX = (canvasWidth - textWidth / 2) / 2;

        mCanvas.drawText(text, startPositionX, mTextureWidth-12, paint);
        paint = null;
    }

    // Flip the texture vertically.
    Matrix flip = new Matrix();

    flip.postScale(1f, -1f);

    Bitmap temp = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), flip, true);

    // Copy bitmap pixels into buffer.
    mPixelBuffer.rewind();

    temp.copyPixelsToBuffer(mPixelBuffer);

    // Cleanup
    temp.recycle();
    temp = null;
    flip = null;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:09:14+00:00Added an answer on May 30, 2026 at 4:09 pm

    Im not sure what section you are referring to by ‘this block’ so i assume you mean the whole method. You are creating objects inside this method

    here

    Paint paint = new Paint();
    

    and here

     Bitmap temp = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), flip, true);
    

    so if this method is being called often you will see these objects GC’d quite alot. You should use an approach that does not require you to create objects on every call. For example you could create the bitmap the first time the method is run and then manipulate the canvas of that bitmap to achieve your flip.

    You can grab the canvas in the constructor and manipulate at the start of each method call with rotate(). This way you can just create the Bitmap and Canvas on first method call.

    Also, whenever you create a Bitmap this can allocate video memory to this also, so its even more inefficient that it looks!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm tearing my hair out with this one. If I start a block comment
I am writing this comment class: class Comment { public $id; public $post_id; public
I know you can comment out a whole section of code like so: /*
Just curious how you would comment this line of code: string customerNm = customerNm.EndsWith(s)
So in the code below you'll notice the comment // This item is obfuscated
This comment confuses me: kill -l generally lists all signals. I thought that a
just saw this comment in a what JS lib do you use poll @Xanti
I read this comment in the OpenID post on the stackoverflow blog. Kibbee says
Couldn't comment on this post, which states the problem I'm experiencing: jQuery remove() on
I'm try something from this comment idea Code Igniter Controller/Model name conflicts find class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.