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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:30:30+00:00 2026-05-15T22:30:30+00:00

I have created an object in Java, Named FOO. FOO contains a large amount

  • 0

I have created an object in Java, Named FOO. FOO contains a large amount of data.. I don’t know say for a ten mega byte text file that I have pulled into ram for manipulation.(This is just an example)

This is clearly a huge amount of space and I want to deallocate it from memory. I set FOO to NULL.

Will this free up that space in memory automatically?
or
Will the memory taken by the loaded text file be around until automatic garbage collection?

  • 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-15T22:30:30+00:00Added an answer on May 15, 2026 at 10:30 pm

    When you set the reference of any object to null, it becomes available for garbage collection. It still occupies the memory until the garbage collector actually runs. There are no guarantees regarding when GC will run except that it will definitely run and reclaim memory from unreachable objects before an OutOfMemoryException is thrown.

    You can call System.gc() to request garbage collection, however, that’s what it is – a request. It is upto GC’s discretion to run.

    Using a WeakReference can help in some cases. See this article by Brian Goetz.

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

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As far as I know it is not possible to… May 16, 2026 at 4:45 pm
  • Editorial Team
    Editorial Team added an answer What I'm wondering is if there is a way to… May 16, 2026 at 4:45 pm
  • Editorial Team
    Editorial Team added an answer This is one of several features of ManyCam (free). It… May 16, 2026 at 4:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a problem with a specific java client library. Here is the situation:
I've used them in java and didn't seem to have too many issues, but
First i have declare that i am new to javascript. I have created a
I'm using Hibernate/JPA and have an @Entity object called Order, pointing at a MySQL
I have two Java class hierarchies that share a common ancestor and implement a
When creating a simple object hierarchy in Python, I'd like to be able to
I'm trying to implement a Hibernate persistence layer in a Java application and I'm
I am trying to do a very simple command line library for interactive Java
I'm working now together with others in a grails project. I have to write
I have a web service method where I would like to throw some custom

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.