Nice garbage collector for C extensions!

N

Nick Jacobson

In the Python documentation on Extending and Embedding (in section
1.10), there's a quote:

"Maybe some day a sufficiently portable automatic garbage collector
will be available for C. Until then, we'll have to live with reference
counts."

What about the Boehm-Demers-Weiser conservative garbage collector (at
http://www.hpl.hp.com/personal/Hans_Boehm/gc/)?

They state, "The collector is not completely portable, but the
distribution includes ports to most standard PC and UNIX/Linux
platforms. The collector should work on Linux, *BSD, recent Windows
versions, MacOS X, HP/UX, Solaris, Tru64, Irix and a few other
operating systems. Some ports are more polished than others."

That's not bad! :)

The license also looks good, and it states, "Both space and time
overhead are likely to be only slightly higher for programs written
for malloc/free."

--Nick
 
D

Dominic

I think it had been done in the
1.5 or 1.4 days....
I therefore assume it did not
work quite as advertised.
Probably memory consumption is
much higher and less deterministic
than with reference counting.
PLT scheme seems to use this
garbage collector and it
consumes 40-50 MB, but including
GUI with editing and interactive
shell.

Maybe someone else who knows more
about this topic can comment or
give reference

ciao,
Dominic
 
M

Michael Hudson

In the Python documentation on Extending and Embedding (in section
1.10), there's a quote:

"Maybe some day a sufficiently portable automatic garbage collector
will be available for C. Until then, we'll have to live with reference
counts."

What about the Boehm-Demers-Weiser conservative garbage collector (at
http://www.hpl.hp.com/personal/Hans_Boehm/gc/)?

It's been tried, with unspectacular results. Google can probably find
more gory details.
They state, "The collector is not completely portable, but the
distribution includes ports to most standard PC and UNIX/Linux
platforms. The collector should work on Linux, *BSD, recent Windows
versions, MacOS X, HP/UX, Solaris, Tru64, Irix and a few other
operating systems. Some ports are more polished than others."

Python has been ported to the Palm Pilot, Nokia Series 60, VMS,
Amiga...

Cheers,
mwh
 
N

Nick Jacobson

It's been tried, with unspectacular results.

What's been tried? I was suggesting using this garbage collector to
avoid the need for reference counting when writing C extensions. Has
that been tried? And if so, what do you mean by "unspectacular"?
Google can probably find
more gory details.

Searching Google for what exactly? :p
Python has been ported to the Palm Pilot, Nokia Series 60, VMS,
Amiga...

Cheers,
mwh

That's true. But the need for a few more ports shouldn't sink the
idea completely..

Thanks for the reply,

--Nick
 
T

Tim Peters

[Nick Jacobson]
[Michael Hudson]
It's been tried, with unspectacular results.
[Nick]
What's been tried?

Using BDW with Python, by several people over a span of years.
I was suggesting using this garbage collector to avoid the need for reference
counting when writing C extensions. Has that been tried?
Right.

And if so, what do you mean by "unspectacular"?

Crashes and slowdowns.
Searching Google for what exactly? :p

Start with

Python Boehm
 
M

Michael Hudson

Tim Peters said:
[Nick Jacobson]
[Michael Hudson]
It's been tried, with unspectacular results.
[Nick]
What's been tried?

Using BDW with Python, by several people over a span of years.
I was suggesting using this garbage collector to avoid the need for reference
counting when writing C extensions. Has that been tried?
Right.

And if so, what do you mean by "unspectacular"?

Crashes and slowdowns.

Were there crashes? I don't remember that bit...

Cheers,
mwh
 
N

Neil Schemenauer

Were there crashes? I don't remember that bit...

If the GC cannot find all roots then it will free memory that's
still used. I think the _tkinter module had some problems and
perhaps readline as well.

Neil
 
M

Michael Hudson

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,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top