can garbeg collector be assisted by compiler

M

mlimber

mangesh said:
Garbage collection is done at runtime .Then how compiler can assist it.
Compiler plays no role at runtime . It is stated so on link
"http://www.iecc.com/gclist/GC-faq.html#Common questions" .

The full quote reads: "Garbage collection is a part of a language's
runtime system, or an add-on library, perhaps assisted by the compiler,
the hardware, the OS, or any combination of the three, that
automatically determines what memory a program is no longer using, and
recycles it for other use. It is also known as 'automatic storage (or
memory) reclamation'."

Any compiler that helps (e.g., by inserting some extra code here or
there to help in GC) is outside the current C++ Standard on this point,
though "C++0x will most likely support optional garbage collection"
(http://www.artima.com/cppsource/cpp0x.html).

Cheers! --M
 
J

Jerry Coffin

Garbage collection is done at runtime .Then how compiler can assist it.
Compiler plays no role at runtime . It is stated so on link
"http://www.iecc.com/gclist/GC-faq.html#Common questions" .

The compiler itself plays no role at runtime (in the traditional
compiler model) but that's more or less irrelevant. The compiler can
do things like ensuring that (at runtime) the garbage collector can
figure out what's a pointer vs. some other value that might happen to
look like a pointer.

Some concurrent garbage collectors also require reduced access to
data at particular times. They might (for example) allow data to be
read, but not modified while garbage collection is taking place. Such
a write barrier nearly always needs at least some support from the
compiler. Likewise, there are other forms of GC that require a read
barrier at times.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top