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 8966109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:57:19+00:00 2026-06-15T16:57:19+00:00

This answer tells me that calling the recycle() method of a TypedArray allows for

  • 0

This answer tells me that calling the recycle() method of a TypedArray allows for it to be garbage collected. My question is why TypedArray specifically needs a method for it to be garbage collected? Why can’t it just wait to be garbage collected like a regular object?

  • 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-06-15T16:57:20+00:00Added an answer on June 15, 2026 at 4:57 pm

    This is required for caching purporse. When you call recycle it means that this object can be reused from this point. Internally TypedArray contains few arrays so in order not to allocate memory each time when TypedArray is used it is cached in Resources class as static field. You can look at TypedArray.recycle() method code:

    /**
     * Give back a previously retrieved StyledAttributes, for later re-use.
     */
    public void recycle() {
        synchronized (mResources.mTmpValue) {
            TypedArray cached = mResources.mCachedStyledAttributes;
            if (cached == null || cached.mData.length < mData.length) {
                mXml = null;
                mResources.mCachedStyledAttributes = this;
            }
        }
    }
    

    So when you call recycle your TypedArray object is just returned back to cache.

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

Sidebar

Related Questions

in this answer he said that i can use RIA services while creating my
OK, this feels like a question that should be easy to answer, but as
The answer to this question: Declarative Security--what's this? Doesn't really tell me much... doesn't
In this answer to this question , Lachlan-Hunt writes the following: With HTML5, you
Long-delayed update I'm accepting MUG4N's answer to this question, and I also want to
I've asked this question recently a few different ways, but don't get an answer
I think I already know the answer to this question because it seems, uh,
I'm having issues with my noggin... Please help me answer this question: is it
I know that polymorphism can add a noticeable overhead. Calling a virtual function is
This answer has helped me largely but hasn't fully resolved my issues. I'm using

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.