Python and Boehm-Demers GC, I have code.

Neil Schemenauer nascheme at ucalgary.ca
Sat Jul 17 18:39:29 EDT 1999


Tim Peters <tim_one at email.msn.com> wrote:
>pybench and pystone have small working sets (they're primarily CPU-speed
>tests); so there's very little reachable for BDW to trace, so BDW doesn't
>have much to do, so runs fast when it's invoked; and with refcounting on,
>most pystone/pybench needs are handled by internal free lists that don't
>invoke malloc at all after initial setup, so BDW doesn't even get called
>often.  IOW, BDW likely isn't doing much of anything in these tests besides
>some initial mallocs.

What could I use as a better benchmark?  Real applications would
be best I suppose.

>I don't think that's going to be happen:  Python doesn't ask anyone to
>change anything about how they like to handle their memory today, and Guido
>has pronounced that a Major Feature on multiple occasions.  Vladimir
>Marangozov's PyMalloc (see his Starship page) caters to that, letting Python
>use its own malloc without anyone else getting involved.

Perhaps I misunderstand, but I thought that the PyMem_* functions
were created for this purpose.  Extension modules can use any
malloc they like but they can't mix malloc/free/realloc with
PyMem_*.

>On one particular platform, and that platform's version of threads (or are
>you running without threads?), yes -- looks great so far <wink>.

Yes, one platform, no threads.  Thanks a lot Tim.  Here I was
feeling pretty good about myself.  Now I'm depressed.

>> With some tuning maybe the gc version of Python will perform
>> better than the regular version.
>
>With or without refcounting?  As before, I think refcounting's contribution
>to Python's current performance is vastly under-appreciated.

With.

>[about Tkinter callbacks]
>> This is really nasty.  I am trying to allocate this data with
>> regular malloc.  If I use malloc and free then this data should
>> not get collected and the GC should realize that the Python
>> functions still have references to them.
>
>This won't work.  A pointer *must* be reachable from *Python's* "root set",
>else BDW won't know it exists.

<homer>Mmmm, documentation</homer>.  I think I have the problem
licked now.  I use GC_malloc_uncollectable for these things.

>btw-keep-in-mind-that-software-doesn't-work<wink>-ly y'rs  - tim

No kidding.  I tried to compile this stuff under Windows.  What a
nightmare.  I'm going to have to take some time off and lick my
wounds.  :)


    Neil




More information about the Python-list mailing list