Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libbacktrace
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
libbacktrace
Commits
b0d69033
Commit
b0d69033
authored
Jan 24, 2018
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* mmap.c (backtrace_free_locked): Don't put more than 16 entries
on the free list. Fixes #5 Fixes rust-lang/rust#29293 Fixes rust-lang/rust#37477
parent
3739537b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
mmap.c
mmap.c
+23
-1
No files found.
mmap.c
View file @
b0d69033
...
...
@@ -69,11 +69,33 @@ struct backtrace_freelist_struct
static
void
backtrace_free_locked
(
struct
backtrace_state
*
state
,
void
*
addr
,
size_t
size
)
{
/* Just leak small blocks. We don't have to be perfect. */
/* Just leak small blocks. We don't have to be perfect. Don't put
more than 16 entries on the free list, to avoid wasting time
searching when allocating a block. If we have more than 16
entries, leak the smallest entry. */
if
(
size
>=
sizeof
(
struct
backtrace_freelist_struct
))
{
size_t
c
;
struct
backtrace_freelist_struct
**
ppsmall
;
struct
backtrace_freelist_struct
**
pp
;
struct
backtrace_freelist_struct
*
p
;
c
=
0
;
ppsmall
=
NULL
;
for
(
pp
=
&
state
->
freelist
;
*
pp
!=
NULL
;
pp
=
&
(
*
pp
)
->
next
)
{
if
(
ppsmall
==
NULL
||
(
*
pp
)
->
size
<
(
*
ppsmall
)
->
size
)
ppsmall
=
pp
;
++
c
;
}
if
(
c
>=
16
)
{
if
(
size
<=
(
*
ppsmall
)
->
size
)
return
;
*
ppsmall
=
(
*
ppsmall
)
->
next
;
}
p
=
(
struct
backtrace_freelist_struct
*
)
addr
;
p
->
next
=
state
->
freelist
;
p
->
size
=
size
;
...
...
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