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
dcc819a5
Commit
dcc819a5
authored
Mar 22, 2002
by
Neil Schemenauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use pymalloc if it's enabled.
parent
a1a9c51a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
24 deletions
+24
-24
Modules/gcmodule.c
Modules/gcmodule.c
+4
-4
Objects/dictobject.c
Objects/dictobject.c
+2
-2
Objects/rangeobject.c
Objects/rangeobject.c
+2
-2
Objects/sliceobject.c
Objects/sliceobject.c
+2
-2
Objects/stringobject.c
Objects/stringobject.c
+7
-7
Objects/structseq.c
Objects/structseq.c
+2
-2
Objects/unicodeobject.c
Objects/unicodeobject.c
+5
-5
No files found.
Modules/gcmodule.c
View file @
dcc819a5
...
...
@@ -829,7 +829,7 @@ _PyObject_GC_Malloc(PyTypeObject *tp, int nitems)
const
size_t
basicsize
=
_PyObject_VAR_SIZE
(
tp
,
nitems
);
#ifdef WITH_CYCLE_GC
const
size_t
nbytes
=
sizeof
(
PyGC_Head
)
+
basicsize
;
PyGC_Head
*
g
=
PyObject
_MALLOC
(
nbytes
);
PyGC_Head
*
g
=
_PyMalloc
_MALLOC
(
nbytes
);
if
(
g
==
NULL
)
return
(
PyObject
*
)
PyErr_NoMemory
();
g
->
gc
.
gc_next
=
NULL
;
...
...
@@ -845,7 +845,7 @@ _PyObject_GC_Malloc(PyTypeObject *tp, int nitems)
}
op
=
FROM_GC
(
g
);
#else
op
=
PyObject
_MALLOC
(
basicsize
);
op
=
_PyMalloc
_MALLOC
(
basicsize
);
if
(
op
==
NULL
)
return
(
PyObject
*
)
PyErr_NoMemory
();
...
...
@@ -896,9 +896,9 @@ _PyObject_GC_Del(PyObject *op)
if
(
allocated
>
0
)
{
allocated
--
;
}
PyObject
_FREE
(
g
);
_PyMalloc
_FREE
(
g
);
#else
PyObject
_FREE
(
op
);
_PyMalloc
_FREE
(
op
);
#endif
}
Objects/dictobject.c
View file @
dcc819a5
...
...
@@ -1914,7 +1914,7 @@ static PyObject *
dictiter_new
(
dictobject
*
dict
,
binaryfunc
select
)
{
dictiterobject
*
di
;
di
=
Py
Object_NEW
(
dictiterobject
,
&
PyDictIter_Type
);
di
=
Py
Malloc_New
(
dictiterobject
,
&
PyDictIter_Type
);
if
(
di
==
NULL
)
return
NULL
;
Py_INCREF
(
dict
);
...
...
@@ -1929,7 +1929,7 @@ static void
dictiter_dealloc
(
dictiterobject
*
di
)
{
Py_DECREF
(
di
->
di_dict
);
Py
Object_DEL
(
di
);
Py
Malloc_Del
(
di
);
}
static
PyObject
*
...
...
Objects/rangeobject.c
View file @
dcc819a5
...
...
@@ -60,7 +60,7 @@ PyObject *
PyRange_New
(
long
start
,
long
len
,
long
step
,
int
reps
)
{
long
totlen
=
-
1
;
rangeobject
*
obj
=
Py
Object_NEW
(
rangeobject
,
&
PyRange_Type
);
rangeobject
*
obj
=
Py
Malloc_New
(
rangeobject
,
&
PyRange_Type
);
if
(
obj
==
NULL
)
return
NULL
;
...
...
@@ -104,7 +104,7 @@ PyRange_New(long start, long len, long step, int reps)
static
void
range_dealloc
(
rangeobject
*
r
)
{
Py
Object_DEL
(
r
);
Py
Malloc_Del
(
r
);
}
static
PyObject
*
...
...
Objects/sliceobject.c
View file @
dcc819a5
...
...
@@ -60,7 +60,7 @@ PyObject _Py_EllipsisObject = {
PyObject
*
PySlice_New
(
PyObject
*
start
,
PyObject
*
stop
,
PyObject
*
step
)
{
PySliceObject
*
obj
=
Py
Object_NEW
(
PySliceObject
,
&
PySlice_Type
);
PySliceObject
*
obj
=
Py
Malloc_New
(
PySliceObject
,
&
PySlice_Type
);
if
(
obj
==
NULL
)
return
NULL
;
...
...
@@ -115,7 +115,7 @@ slice_dealloc(PySliceObject *r)
Py_DECREF
(
r
->
step
);
Py_DECREF
(
r
->
start
);
Py_DECREF
(
r
->
stop
);
Py
Object_DEL
(
r
);
Py
Malloc_Del
(
r
);
}
static
PyObject
*
...
...
Objects/stringobject.c
View file @
dcc819a5
...
...
@@ -68,7 +68,7 @@ PyString_FromStringAndSize(const char *str, int size)
/* PyObject_NewVar is inlined */
op
=
(
PyStringObject
*
)
PyObject
_MALLOC
(
sizeof
(
PyStringObject
)
+
size
*
sizeof
(
char
));
_PyMalloc
_MALLOC
(
sizeof
(
PyStringObject
)
+
size
*
sizeof
(
char
));
if
(
op
==
NULL
)
return
PyErr_NoMemory
();
PyObject_INIT_VAR
(
op
,
&
PyString_Type
,
size
);
...
...
@@ -131,7 +131,7 @@ PyString_FromString(const char *str)
/* PyObject_NewVar is inlined */
op
=
(
PyStringObject
*
)
PyObject
_MALLOC
(
sizeof
(
PyStringObject
)
+
size
*
sizeof
(
char
));
_PyMalloc
_MALLOC
(
sizeof
(
PyStringObject
)
+
size
*
sizeof
(
char
));
if
(
op
==
NULL
)
return
PyErr_NoMemory
();
PyObject_INIT_VAR
(
op
,
&
PyString_Type
,
size
);
...
...
@@ -733,7 +733,7 @@ string_concat(register PyStringObject *a, register PyObject *bb)
size
=
a
->
ob_size
+
b
->
ob_size
;
/* PyObject_NewVar is inlined */
op
=
(
PyStringObject
*
)
PyObject
_MALLOC
(
sizeof
(
PyStringObject
)
+
size
*
sizeof
(
char
));
_PyMalloc
_MALLOC
(
sizeof
(
PyStringObject
)
+
size
*
sizeof
(
char
));
if
(
op
==
NULL
)
return
PyErr_NoMemory
();
PyObject_INIT_VAR
(
op
,
&
PyString_Type
,
size
);
...
...
@@ -780,7 +780,7 @@ string_repeat(register PyStringObject *a, register int n)
return
NULL
;
}
op
=
(
PyStringObject
*
)
PyObject
_MALLOC
(
sizeof
(
PyStringObject
)
+
nbytes
);
_PyMalloc
_MALLOC
(
sizeof
(
PyStringObject
)
+
nbytes
);
if
(
op
==
NULL
)
return
PyErr_NoMemory
();
PyObject_INIT_VAR
(
op
,
&
PyString_Type
,
size
);
...
...
@@ -2789,7 +2789,7 @@ PyTypeObject PyString_Type = {
0
,
/* tp_init */
0
,
/* tp_alloc */
string_new
,
/* tp_new */
_Py
Object
_Del
,
/* tp_free */
_Py
Malloc
_Del
,
/* tp_free */
};
void
...
...
@@ -2841,10 +2841,10 @@ _PyString_Resize(PyObject **pv, int newsize)
#endif
_Py_ForgetReference
(
v
);
*
pv
=
(
PyObject
*
)
PyObject
_REALLOC
((
char
*
)
v
,
_PyMalloc
_REALLOC
((
char
*
)
v
,
sizeof
(
PyStringObject
)
+
newsize
*
sizeof
(
char
));
if
(
*
pv
==
NULL
)
{
Py
Object_DEL
(
v
);
Py
Malloc_Del
(
v
);
PyErr_NoMemory
();
return
-
1
;
}
...
...
Objects/structseq.c
View file @
dcc819a5
...
...
@@ -22,7 +22,7 @@ PyStructSequence_New(PyTypeObject *type)
{
PyStructSequence
*
obj
;
obj
=
Py
Object
_New
(
PyStructSequence
,
type
);
obj
=
Py
Malloc
_New
(
PyStructSequence
,
type
);
obj
->
ob_size
=
VISIBLE_SIZE_TP
(
type
);
return
(
PyObject
*
)
obj
;
...
...
@@ -37,7 +37,7 @@ structseq_dealloc(PyStructSequence *obj)
for
(
i
=
0
;
i
<
size
;
++
i
)
{
Py_XDECREF
(
obj
->
ob_item
[
i
]);
}
Py
Object_FREE
(
obj
);
Py
Malloc_Del
(
obj
);
}
static
int
...
...
Objects/unicodeobject.c
View file @
dcc819a5
...
...
@@ -201,7 +201,7 @@ PyUnicodeObject *_PyUnicode_New(int length)
PyObject_INIT
(
unicode
,
&
PyUnicode_Type
);
}
else
{
unicode
=
Py
Object_NEW
(
PyUnicodeObject
,
&
PyUnicode_Type
);
unicode
=
Py
Malloc_New
(
PyUnicodeObject
,
&
PyUnicode_Type
);
if
(
unicode
==
NULL
)
return
NULL
;
unicode
->
str
=
PyMem_NEW
(
Py_UNICODE
,
length
+
1
);
...
...
@@ -219,7 +219,7 @@ PyUnicodeObject *_PyUnicode_New(int length)
onError:
_Py_ForgetReference
((
PyObject
*
)
unicode
);
Py
Object_DEL
(
unicode
);
Py
Malloc_Del
(
unicode
);
return
NULL
;
}
...
...
@@ -5711,7 +5711,7 @@ unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
pnew
->
str
=
PyMem_NEW
(
Py_UNICODE
,
n
+
1
);
if
(
pnew
->
str
==
NULL
)
{
_Py_ForgetReference
((
PyObject
*
)
pnew
);
Py
Object_DEL
(
pnew
);
Py
Malloc_Del
(
pnew
);
return
NULL
;
}
Py_UNICODE_COPY
(
pnew
->
str
,
tmp
->
str
,
n
+
1
);
...
...
@@ -5769,7 +5769,7 @@ PyTypeObject PyUnicode_Type = {
0
,
/* tp_init */
0
,
/* tp_alloc */
unicode_new
,
/* tp_new */
_Py
Object
_Del
,
/* tp_free */
_Py
Malloc
_Del
,
/* tp_free */
};
/* Initialize the Unicode implementation */
...
...
@@ -5811,7 +5811,7 @@ _PyUnicode_Fini(void)
if
(
v
->
str
)
PyMem_DEL
(
v
->
str
);
Py_XDECREF
(
v
->
defenc
);
Py
Object_DEL
(
v
);
Py
Malloc_Del
(
v
);
}
unicode_freelist
=
NULL
;
unicode_freelist_size
=
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