File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
5858#error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long long)"
5959#endif /* SIZEOF_PID_T */
6060
61- /* For use by intobject.c only */
61+ /* Used by Python/mystrtoul.c. */
6262PyAPI_DATA (unsigned char ) _PyLong_DigitValue [256 ];
6363
6464/* _PyLong_Frexp returns a double x and an exponent e such that the
Original file line number Diff line number Diff line change 1010 your own types of attributes instead. Maybe you want to name your
1111 local variables other than 'self'. If your object type is needed in
1212 other files, you'll have to create a file "foobarobject.h"; see
13- intobject .h for an example. */
13+ floatobject .h for an example. */
1414
1515/* Xxo objects */
1616
Original file line number Diff line number Diff line change 2121extern int finite (double );
2222#endif
2323
24- /* Special free list -- see comments for same code in intobject.c. */
24+ /* Special free list
25+
26+ Since some Python programs can spend much of their time allocating
27+ and deallocating floats, these operations should be very fast.
28+ Therefore we use a dedicated allocation scheme with a much lower
29+ overhead (in space and time) than straight malloc(): a simple
30+ dedicated free list, filled when necessary with memory from malloc().
31+
32+ block_list is a singly-linked list of all PyFloatBlocks ever allocated,
33+ linked via their next members. PyFloatBlocks are never returned to the
34+ system before shutdown (PyFloat_Fini).
35+
36+ free_list is a singly-linked list of available PyFloatObjects, linked
37+ via abuse of their ob_type members.
38+ */
39+
2540#define BLOCK_SIZE 1000 /* 1K less typical malloc overhead */
2641#define BHEAD_SIZE 8 /* Enough for a 64-bit pointer */
2742#define N_FLOATOBJECTS ((BLOCK_SIZE - BHEAD_SIZE) / sizeof(PyFloatObject))
Original file line number Diff line number Diff line change @@ -391,7 +391,7 @@ static PyGetSetDef frame_getsetlist[] = {
391391 the local variables in f_localsplus are NULL.
392392
393393 2. We also maintain a separate free list of stack frames (just like
394- integers are allocated in a special way -- see intobject .c). When
394+ floats are allocated in a special way -- see floatobject .c). When
395395 a stack frame is on the free list, only the following members have
396396 a meaning:
397397 ob_type == &Frametype
You can’t perform that action at this time.
0 commit comments