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
0c856978
Commit
0c856978
authored
May 03, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Update block unused_bytes in shrink_used_block.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
481ecc2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
heap.c
dlls/ntdll/heap.c
+6
-7
No files found.
dlls/ntdll/heap.c
View file @
0c856978
...
...
@@ -808,17 +808,19 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
}
static
void
shrink_used_block
(
SUBHEAP
*
subheap
,
struct
block
*
block
,
SIZE_T
data_size
)
static
void
shrink_used_block
(
SUBHEAP
*
subheap
,
struct
block
*
block
,
SIZE_T
data_size
,
SIZE_T
size
)
{
SIZE_T
old_data_size
=
block_get_size
(
block
)
-
sizeof
(
*
block
);
if
(
old_data_size
>=
data_size
+
HEAP_MIN_SHRINK_SIZE
)
{
block
->
size
=
data_size
|
block_get_flags
(
block
);
block
->
unused_bytes
=
data_size
-
size
;
HEAP_CreateFreeBlock
(
subheap
,
next_block
(
subheap
,
block
),
old_data_size
-
data_size
);
}
else
{
struct
block
*
next
;
block
->
unused_bytes
=
old_data_size
-
size
;
if
((
next
=
next_block
(
subheap
,
block
)))
next
->
size
&=
~
ARENA_FLAG_PREV_FREE
;
}
}
...
...
@@ -1579,8 +1581,7 @@ static NTSTATUS heap_allocate( HEAP *heap, ULONG flags, SIZE_T size, void **ret
/* Shrink the block */
shrink_used_block
(
subheap
,
pInUse
,
rounded_size
);
pInUse
->
unused_bytes
=
(
pInUse
->
size
&
ARENA_SIZE_MASK
)
-
size
;
shrink_used_block
(
subheap
,
pInUse
,
rounded_size
,
size
);
notify_alloc
(
pInUse
+
1
,
size
,
flags
&
HEAP_ZERO_MEMORY
);
initialize_block
(
pInUse
+
1
,
size
,
pInUse
->
unused_bytes
,
flags
);
...
...
@@ -1687,7 +1688,7 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size
pArena
->
size
+=
block_get_size
(
next
);
if
(
!
HEAP_Commit
(
subheap
,
pArena
,
rounded_size
))
return
STATUS_NO_MEMORY
;
notify_realloc
(
pArena
+
1
,
oldActualSize
,
size
);
shrink_used_block
(
subheap
,
pArena
,
rounded_size
);
shrink_used_block
(
subheap
,
pArena
,
rounded_size
,
size
);
}
else
{
...
...
@@ -1703,11 +1704,9 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size
else
{
notify_realloc
(
pArena
+
1
,
oldActualSize
,
size
);
shrink_used_block
(
subheap
,
pArena
,
rounded_size
);
shrink_used_block
(
subheap
,
pArena
,
rounded_size
,
size
);
}
pArena
->
unused_bytes
=
(
pArena
->
size
&
ARENA_SIZE_MASK
)
-
size
;
/* Clear the extra bytes if needed */
if
(
size
>
oldActualSize
)
...
...
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