summaryrefslogtreecommitdiffstats
path: root/Modules/gcmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Use double curly braces for the generation0/1/2 initializers, to shutGuido van Rossum2001-10-121-3/+3
| | | | up GCC warnings.
* SF bug [#467145] Python 2.2a4 build problem on HPUX 11.0.Tim Peters2001-10-111-56/+56
| | | | | | | | | | | | | | The platform requires 8-byte alignment for doubles, but the GC header was 12 bytes and that threw off the natural alignment of the double members of a subtype of complex. The fix puts the GC header into a union with a double as the other member, to force no-looser-than double alignment of GC headers. On boxes that require 8-byte alignment for doubles, this may add pad bytes to the GC header accordingly; ditto for platforms that *prefer* 8-byte alignment for doubles. On platforms that don't care, it shouldn't change the memory layout (because the size of the old GC header is certainly greater than the size of a double on all platforms, so unioning with a double shouldn't change size or alignment on such boxes).
* Guido suggests, and I agree, to insist that SIZEOF_VOID_P be a power of 2.Tim Peters2001-10-071-12/+4
| | | | | | This simplifies the rounding in _PyObject_VAR_SIZE, allows to restore the pre-rounding calling sequence, and allows some nice little simplifications in its callers. I'm still making it return a size_t, though.
* _PyObject_VAR_SIZE: always round up to a multiple-of-pointer-size value.Tim Peters2001-10-061-14/+21
| | | | | | | | | | | | | | | | | As Guido suggested, this makes the new subclassing code substantially simpler. But the mechanics of doing it w/ C macro semantics are a mess, and _PyObject_VAR_SIZE has a new calling sequence now. Question: The PyObject_NEW_VAR macro appears to be part of the public API. Regardless of what it expands to, the notion that it has to round up the memory it allocates is new, and extensions containing the old PyObject_NEW_VAR macro expansion (which was embedded in the PyObject_NEW_VAR expansion) won't do this rounding. But the rounding isn't actually *needed* except for new-style instances with dict pointers after a variable-length blob of embedded data. So my guess is that we do not need to bump the API version for this (as the rounding isn't needed for anything an extension can do unless it's recompiled anyway). What's your guess?
* Repaired the debug Windows deaths in test_descr, by allocating enoughTim Peters2001-10-061-7/+8
| | | | | | | | | | | | | | pad memory to properly align the __dict__ pointer in all cases. gcmodule.c/objimpl.h, _PyObject_GC_Malloc: + Added a "padding" argument so that this flavor of malloc can allocate enough bytes for alignment padding (it can't know this is needed, but its callers do). typeobject.c, PyType_GenericAlloc: + Allocated enough bytes to align the __dict__ pointer. + Sped and simplified the round-up-to-PTRSIZE logic. + Added blank lines so I could parse the if/else blocks <0.7 wink>.
* _PyObject_GC_Malloc(): split a complicated line in two. As is, there wasTim Peters2001-10-061-2/+3
| | | | | no way to talk the debugger into showing me how many bytes were being allocated.
* Make more things internal to this file. RemoveNeil Schemenauer2001-08-301-93/+148
| | | | | | | | | visit_finalizer_reachable since it's the same as visit_reachable. Rename visit_reachable to visit_move. Objects can now have the GC type flag set, reachable by tp_traverse and not be in a GC linked list. This should make the collector more robust and easier to use by extension module writers. Add memory management functions for container objects (new, del, resize).
* Remove "referents" structure (it's not needed). Check return valueNeil Schemenauer2001-08-101-20/+17
| | | | of PyList_Append.
* Add get_objects function. This is a low level function (likeNeil Schemenauer2001-08-091-0/+38
| | | | | get_referents, and is not yet documented in the library manual). Suggestions for a better name welcome.
* Add get_referents function. Closes SF patch #402925.Neil Schemenauer2001-08-091-0/+50
|
* - update Neil's email addressNeil Schemenauer2000-10-041-6/+2
|
* - do not start collection during processing of an exceptionNeil Schemenauer2000-10-041-1/+5
|
* Fix some long/"l" int/"i" mismatches. Fixes bug #113779.Neil Schemenauer2000-09-221-2/+2
|
* - Add DEBUG_SAVEALL option. When enabled all garbage objects found by theNeil Schemenauer2000-09-221-27/+39
| | | | | | | collector will be saved in gc.garbage. This is useful for debugging a program that creates reference cycles. - Fix else statements in gcmodule.c to conform to Python coding standards.
* compromise value for threshold0: not too high, not too lowJeremy Hylton2000-09-051-1/+1
|
* set the default threshold much higherJeremy Hylton2000-09-011-1/+1
| | | | we don't need to run gc frequently
* refactor __del__ exception handler into PyErr_WriteUnraisableJeremy Hylton2000-09-011-1/+10
| | | | | add sanity check to gc: if an exception occurs during GC, call PyErr_WriteUnraisable and then call Py_FatalEror.
* apply patch #101362 by Vladimir MarangozovJeremy Hylton2000-08-311-33/+24
| | | | also initial static debug variable to 0
* Neil Schemenauer: GC enable(), disable(), isenabled() interface.Vladimir Marangozov2000-08-061-16/+76
| | | | | | Small stylistic changes by VM: - is_enabled() -> isenabled() - static ... Py_<func> -> static ... gc_<func>
* debug_instance(): Use the same %p format directive as withBarry Warsaw2000-07-121-6/+3
| | | | | | debug_cycle(), and don't cast the pointer to a long. Neither needs the literal `0x' prefix as %p automatically inserts this (on Linux at least).
* Always use the :funcname part of the format specifier for PyArg_ParseTuple()Fred Drake2000-07-121-5/+5
| | | | so we get better error messages.
* Neil Schemenauer <nascheme@enme.ucalgary.ca>:Fred Drake2000-07-111-4/+4
| | | | | | | Change a cast, intialize a local, and make some sprintf() format strings type-appropriate (add the "l" to "%d"). Closes SourceForge patch #100737.
* ANSI-ficationPeter Schneider-Kamp2000-07-101-15/+5
|
* Initialize the return value in collect_generations() since it is updatedVladimir Marangozov2000-07-101-1/+1
| | | | conditionally in the code.
* final patches from Neil Schemenauer for garbage collectionJeremy Hylton2000-06-301-0/+679