edited by
805 views
6 votes
6 votes

Suppose we are working with a programming language that supports automatic garbage collection. This means that:

  1. Uninitialized variables are assigned null values.
  2. Unreferenced dynamically allocated memory is added back to free space.
  3. Unreachable $\text{if – then – else}$ branches are pruned.
  4. Expressions where array indices exceed array bounds are flagged.
edited by

1 Answer

Best answer
10 votes
10 votes

Garbage collection  also known as automatic memory management, is the automatic recycling of dynamically allocated memory.
Garbage collection is performed by a garbage collector which recycles memory that it can prove will never be used again.
Systems and languages which use garbage collection can be described as garbage-collected.

As long as address space is available in the memory, the runtime continues to allocate space for new objects.
However, memory is not infinite. Eventually the garbage collector must perform a collection in order to free some memory.
The garbage collector's optimizing engine determines the best time to perform a collection, based upon the allocations being made.

So, option B is correct.

Unreferenced dynamically allocated memory is added back to free space.

edited by

Related questions

1 votes
1 votes
1 answer
3
go_editor asked May 27, 2016
532 views
What are the possible values of $gcd(7p + 94,\: 7p^2 + 97p + 47)$, where $p$ is an arbitrary integer?Either $1$ or $94$Either $94$ or $47$Either $1$ or $47$None of these
1 votes
1 votes
1 answer
4
go_editor asked May 27, 2016
606 views
Let $M$ be the maximum number of unit disks (disks of radius $1$) that can be placed inside a disk of radius $10$ so that each unit disk lies entirely within the larger d...