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
cee4f034
Commit
cee4f034
authored
Jun 19, 2014
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21810: Backport mmap-based arena allocation failure check.
parent
4ade2d25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
Objects/obmalloc.c
Objects/obmalloc.c
+9
-4
No files found.
Objects/obmalloc.c
View file @
cee4f034
...
...
@@ -540,6 +540,8 @@ new_arena(void)
{
struct
arena_object
*
arenaobj
;
uint
excess
;
/* number of bytes above pool alignment */
void
*
address
;
int
err
;
#ifdef PYMALLOC_DEBUG
if
(
Py_GETENV
(
"PYTHONMALLOCSTATS"
))
...
...
@@ -593,12 +595,14 @@ new_arena(void)
unused_arena_objects
=
arenaobj
->
nextarena
;
assert
(
arenaobj
->
address
==
0
);
#ifdef ARENAS_USE_MMAP
arenaobj
->
address
=
(
uptr
)
mmap
(
NULL
,
ARENA_SIZE
,
PROT_READ
|
PROT_WRITE
,
MAP_PRIVATE
|
MAP_ANONYMOUS
,
-
1
,
0
);
address
=
mmap
(
NULL
,
ARENA_SIZE
,
PROT_READ
|
PROT_WRITE
,
MAP_PRIVATE
|
MAP_ANONYMOUS
,
-
1
,
0
);
err
=
(
address
==
MAP_FAILED
);
#else
arenaobj
->
address
=
(
uptr
)
malloc
(
ARENA_SIZE
);
address
=
malloc
(
ARENA_SIZE
);
err
=
(
address
==
0
);
#endif
if
(
arenaobj
->
address
==
0
)
{
if
(
err
)
{
/* The allocation failed: return NULL after putting the
* arenaobj back.
*/
...
...
@@ -606,6 +610,7 @@ new_arena(void)
unused_arena_objects
=
arenaobj
;
return
NULL
;
}
arenaobj
->
address
=
(
uptr
)
address
;
++
narenas_currently_allocated
;
#ifdef PYMALLOC_DEBUG
...
...
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