Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8cfaa0e7
Commit
8cfaa0e7
authored
Mar 02, 2006
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trimmed trailing whitespace.
parent
2e63b73a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
Include/pyarena.h
Include/pyarena.h
+1
-1
Python/pyarena.c
Python/pyarena.c
+6
-6
No files found.
Include/pyarena.h
View file @
8cfaa0e7
...
...
@@ -26,7 +26,7 @@ extern "C" {
/* This routines isn't a proper arena allocation routine. It takes
a PyObject* and records it so that it can be DECREFed when the
arena is freed.
*/
*/
PyAPI_FUNC
(
int
)
PyArena_AddPyObject
(
PyArena
*
,
PyObject
*
);
#ifdef __cplusplus
...
...
Python/pyarena.c
View file @
8cfaa0e7
#include "Python.h"
#include "pyarena.h"
/* A simple arena block structure
/* A simple arena block structure
Measurements with standard library modules suggest the average
allocation is about 20 bytes and that most compiles use a single
...
...
@@ -20,7 +20,7 @@ typedef struct _block {
and a list of PyObject* pointers. PyObjects are decrefed
when the arena is freed.
*/
struct
_arena
{
block
*
a_head
;
block
*
a_cur
;
...
...
@@ -38,7 +38,7 @@ struct _arena {
static
block
*
block_new
(
size_t
size
)
{
/* Allocate header and block as one unit.
/* Allocate header and block as one unit.
ab_mem points just past header. */
block
*
b
=
(
block
*
)
malloc
(
sizeof
(
block
)
+
size
);
if
(
!
b
)
...
...
@@ -120,7 +120,7 @@ PyArena_Free(PyArena *arena)
assert
(
arena
);
#if defined(Py_DEBUG)
/*
fprintf(stderr,
fprintf(stderr,
"alloc=%d size=%d blocks=%d block_size=%d big=%d objects=%d\n",
arena->total_allocs, arena->total_size, arena->total_blocks,
arena->total_block_size, arena->total_big_blocks,
...
...
@@ -134,7 +134,7 @@ PyArena_Free(PyArena *arena)
}
void
*
PyArena_Malloc
(
PyArena
*
arena
,
size_t
size
)
PyArena_Malloc
(
PyArena
*
arena
,
size_t
size
)
{
void
*
p
=
block_alloc
(
arena
->
a_cur
,
size
);
if
(
!
p
)
...
...
@@ -157,7 +157,7 @@ PyArena_Malloc(PyArena *arena, size_t size)
}
int
PyArena_AddPyObject
(
PyArena
*
arena
,
PyObject
*
obj
)
PyArena_AddPyObject
(
PyArena
*
arena
,
PyObject
*
obj
)
{
int
r
=
PyList_Append
(
arena
->
a_objects
,
obj
);
if
(
r
>=
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment