Re: Garbage collection



John Nagle <nagle@xxxxxxxxxxx> writes:
Richard Tobin wrote:
In article <1191279224.654464.215290@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<rbj@xxxxxxxxxxxxxx> wrote:
I believe that the Committee should add garbage collection in the next
version of the Standard.
What exactly would this garbage collection be required to do?
A conservative collector (e.g. the Boehm collector) cannot reliably
collect all garbage (because there may be things that look like
pointers but aren't), and may discard non-garbage data if pointers
are encoded (e.g. when implementing other languages and putting
type bits in the low-order bits of a pointer).

This is a memory population issue. As the fraction of the
address space in use increases, the odds that a random value is
a valid address increases. This continues until the address
space is increased. Right now, we're in the worst part of the
cycle - machines have a few gigabytes of memory but are
mostly 32 bit, with 4 gigabytes of address space.

This was less of a problem in, say, the VAX era, when
machines had maybe 4MB of a 4GB address space, and most apps
were far smaller. Today, we routinely have applications with
a gigabyte or more of heap.

For 64-bit machines, this is much less of a problem.
The odds of a random value being in the first few gigabytes
of the address space are low.
[...]

Sure, but computer memory is not typically filled with random values.
It's likely that a *lot* of 64-bit integers will happen to hold
relatively small values. If valid memory addresses have non-zero
values only in, say, the bottom 33 or 34 bits, then you'll see more
arbitrary integers coincidentally matching memory addresses than you
would if everything were random.

If you can manage to set up your virtual memory so that valid memory
addresses aren't likely integer values, you can largely avoid this
problem.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.



Relevant Pages

  • Re: Article of interest: Python pros/cons for the enterprise
    ... from many articles and postings across the internet memory management ... There are other downsides to garbage collection, ... not the way it goes in practice nowadays, ...
    (comp.lang.python)
  • Re: C vs C++ in Embedded Systems?
    ... >>the garbage collection system be able to find every pointer that it needs ... >>ensuring that all pointer variables actually point to allocated memory. ... references, by definition, in these languages. ...
    (comp.arch.embedded)
  • Re: C++ Garbage Collector on VMS?
    ... Boehm GC, afaict, is very popular among such ... or how it relates to what you are doing in lisp. ... about the Boehm GC nor what triggers its doing a garbage collection ... definitions and pointers were given "memory" from a free area. ...
    (comp.os.vms)
  • Re: clustering of objects in a VM
    ... I.e., if during say, an ephemeral collection cycle, two objects were ... accessed within the same ephemeral cycle the collector knows what memory was ... > references in the system to objectB and objectC. ...
    (comp.lang.smalltalk)
  • Re: More on garbage collection
    ... but adding garbage collection is a disaster. ... on the memory layout. ... Please note that this is a theoretically soluble problem. ... All garbage collection languages that I know of fail ...
    (sci.crypt)