Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2175852f
Commit
2175852f
authored
Oct 09, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Oct 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add free list buckets for every arena size up to 0x100.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8273fc88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
heap.c
dlls/ntdll/heap.c
+16
-6
No files found.
dlls/ntdll/heap.c
View file @
2175852f
...
@@ -105,6 +105,7 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
...
@@ -105,6 +105,7 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
/* minimum data size (without arenas) of an allocated block */
/* minimum data size (without arenas) of an allocated block */
/* make sure that it's larger than a free list entry */
/* make sure that it's larger than a free list entry */
#define HEAP_MIN_DATA_SIZE ROUND_SIZE(2 * sizeof(struct list))
#define HEAP_MIN_DATA_SIZE ROUND_SIZE(2 * sizeof(struct list))
#define HEAP_MIN_ARENA_SIZE (HEAP_MIN_DATA_SIZE + sizeof(ARENA_INUSE))
/* minimum size that must remain to shrink an allocated block */
/* minimum size that must remain to shrink an allocated block */
#define HEAP_MIN_SHRINK_SIZE (HEAP_MIN_DATA_SIZE+sizeof(ARENA_FREE))
#define HEAP_MIN_SHRINK_SIZE (HEAP_MIN_DATA_SIZE+sizeof(ARENA_FREE))
/* minimum size to start allocating large blocks */
/* minimum size to start allocating large blocks */
...
@@ -113,12 +114,17 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
...
@@ -113,12 +114,17 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
#define HEAP_TAIL_EXTRA_SIZE(flags) \
#define HEAP_TAIL_EXTRA_SIZE(flags) \
((flags & HEAP_TAIL_CHECKING_ENABLED) || RUNNING_ON_VALGRIND ? ALIGNMENT : 0)
((flags & HEAP_TAIL_CHECKING_ENABLED) || RUNNING_ON_VALGRIND ? ALIGNMENT : 0)
/* Max size of the blocks on the free lists */
/* There will be a free list bucket for every arena size up to and including this value */
#define HEAP_MAX_SMALL_FREE_LIST 0x100
C_ASSERT
(
HEAP_MAX_SMALL_FREE_LIST
%
ALIGNMENT
==
0
);
#define HEAP_NB_SMALL_FREE_LISTS (((HEAP_MAX_SMALL_FREE_LIST - HEAP_MIN_ARENA_SIZE) / ALIGNMENT) + 1)
/* Max size of the blocks on the free lists above HEAP_MAX_SMALL_FREE_LIST */
static
const
SIZE_T
HEAP_freeListSizes
[]
=
static
const
SIZE_T
HEAP_freeListSizes
[]
=
{
{
0x
10
,
0x20
,
0x30
,
0x40
,
0x60
,
0x80
,
0x100
,
0x
200
,
0x400
,
0x1000
,
~
0UL
0x200
,
0x400
,
0x1000
,
~
0UL
};
};
#define HEAP_NB_FREE_LISTS
(sizeof(HEAP_freeListSizes)/sizeof(HEAP_freeListSizes[0])
)
#define HEAP_NB_FREE_LISTS
(sizeof(HEAP_freeListSizes) / sizeof(HEAP_freeListSizes[0]) + HEAP_NB_SMALL_FREE_LISTS
)
typedef
union
typedef
union
{
{
...
@@ -303,8 +309,11 @@ static inline unsigned int get_freelist_index( SIZE_T size )
...
@@ -303,8 +309,11 @@ static inline unsigned int get_freelist_index( SIZE_T size )
{
{
unsigned
int
i
;
unsigned
int
i
;
size
-=
sizeof
(
ARENA_FREE
);
if
(
size
<=
HEAP_MAX_SMALL_FREE_LIST
)
for
(
i
=
0
;
i
<
HEAP_NB_FREE_LISTS
-
1
;
i
++
)
if
(
size
<=
HEAP_freeListSizes
[
i
])
break
;
return
(
size
-
HEAP_MIN_ARENA_SIZE
)
/
ALIGNMENT
;
for
(
i
=
HEAP_NB_SMALL_FREE_LISTS
;
i
<
HEAP_NB_FREE_LISTS
-
1
;
i
++
)
if
(
size
<=
HEAP_freeListSizes
[
i
-
HEAP_NB_SMALL_FREE_LISTS
])
break
;
return
i
;
return
i
;
}
}
...
@@ -338,7 +347,8 @@ static void HEAP_Dump( HEAP *heap )
...
@@ -338,7 +347,8 @@ static void HEAP_Dump( HEAP *heap )
DPRINTF
(
"
\n
Free lists:
\n
Block Stat Size Id
\n
"
);
DPRINTF
(
"
\n
Free lists:
\n
Block Stat Size Id
\n
"
);
for
(
i
=
0
;
i
<
HEAP_NB_FREE_LISTS
;
i
++
)
for
(
i
=
0
;
i
<
HEAP_NB_FREE_LISTS
;
i
++
)
DPRINTF
(
"%p free %08lx prev=%p next=%p
\n
"
,
DPRINTF
(
"%p free %08lx prev=%p next=%p
\n
"
,
&
heap
->
freeList
[
i
].
arena
,
HEAP_freeListSizes
[
i
],
&
heap
->
freeList
[
i
].
arena
,
i
<
HEAP_NB_SMALL_FREE_LISTS
?
HEAP_MIN_ARENA_SIZE
+
i
*
ALIGNMENT
:
HEAP_freeListSizes
[
i
-
HEAP_NB_SMALL_FREE_LISTS
],
LIST_ENTRY
(
heap
->
freeList
[
i
].
arena
.
entry
.
prev
,
ARENA_FREE
,
entry
),
LIST_ENTRY
(
heap
->
freeList
[
i
].
arena
.
entry
.
prev
,
ARENA_FREE
,
entry
),
LIST_ENTRY
(
heap
->
freeList
[
i
].
arena
.
entry
.
next
,
ARENA_FREE
,
entry
));
LIST_ENTRY
(
heap
->
freeList
[
i
].
arena
.
entry
.
next
,
ARENA_FREE
,
entry
));
...
...
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