Garbage collector in C#

R

Robert Bralic

Alllo,

Sory I' cant find news group for C#.
And my question is how is posible to implement
a grbage collectoe in language that have pointers.
When you put some adres in way like c = &p,
where c is a pointer on object that is instance
of some classe, so that garbage collector can work
you must programably analyze complete source
code, that s realy imposible to make a priogram
of this level of intelligence.
Maybye this is not wrong group becouse I hearded
that exists a grbage collector for C++.



Thanks in advance !
(e-mail address removed)
 
R

Rolf Magnus

Robert said:
Alllo,

Sory I' cant find news group for C#.
And my question is how is posible to implement
a grbage collectoe in language that have pointers.
When you put some adres in way like c = &p,
where c is a pointer on object that is instance
of some classe, so that garbage collector can work
you must programably analyze complete source
code, that s realy imposible to make a priogram
of this level of intelligence.
Maybye this is not wrong group becouse I hearded
that exists a grbage collector for C++.

Well, there is the Boehm GC for C and C++.
See http://www.hpl.hp.com/personal/Hans_Boehm/gc/
 
D

Derrick Coetzee

Robert said:
And my question is how is posible to implement
a grbage collectoe in language that have pointers.

In short, it's not, if pointers are unrestricted as in C or C++, for
several reasons, but mostly because pointers can be computed in
arbitrary ways from stored integers. It's provably impossible for any GC
scheme to detect all such "hidden" pointers.

On the other hand, people do this so rarely, and even when they do it in
such a small number of common ways, that an ordinary garbage collector
does a pretty good job on your average C or C++ program. After all,
leaking memory really slowly isn't so bad, particularly in applications
that don't run for months.
 

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
474,175
Messages
2,570,942
Members
47,489
Latest member
BrigidaD91

Latest Threads

Top