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
46adbecd
Commit
46adbecd
authored
Apr 14, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Insert the last free block of a subheap at the end of the free list to
avoid using uncomitted space unless really necessary.
parent
96af8c2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
heap.c
dlls/ntdll/heap.c
+24
-8
No files found.
dlls/ntdll/heap.c
View file @
46adbecd
...
...
@@ -290,15 +290,29 @@ static HEAP *HEAP_GetPtr(
*
* Insert a free block into the free list.
*/
static
void
HEAP_InsertFreeBlock
(
HEAP
*
heap
,
ARENA_FREE
*
pArena
)
static
inline
void
HEAP_InsertFreeBlock
(
HEAP
*
heap
,
ARENA_FREE
*
pArena
,
BOOL
last
)
{
FREE_LIST_ENTRY
*
pEntry
=
heap
->
freeList
;
while
(
pEntry
->
size
<
pArena
->
size
)
pEntry
++
;
pArena
->
size
|=
ARENA_FLAG_FREE
;
pArena
->
next
=
pEntry
->
arena
.
next
;
pArena
->
next
->
prev
=
pArena
;
pArena
->
prev
=
&
pEntry
->
arena
;
pEntry
->
arena
.
next
=
pArena
;
if
(
last
)
{
/* insert at end of free list, i.e. before the next free list entry */
pEntry
++
;
if
(
pEntry
==
&
heap
->
freeList
[
HEAP_NB_FREE_LISTS
])
pEntry
=
heap
->
freeList
;
pArena
->
prev
=
pEntry
->
arena
.
prev
;
pArena
->
prev
->
next
=
pArena
;
pArena
->
next
=
&
pEntry
->
arena
;
pEntry
->
arena
.
prev
=
pArena
;
}
else
{
/* insert at head of free list */
pArena
->
next
=
pEntry
->
arena
.
next
;
pArena
->
next
->
prev
=
pArena
;
pArena
->
prev
=
&
pEntry
->
arena
;
pEntry
->
arena
.
next
=
pArena
;
}
pArena
->
size
|=
ARENA_FLAG_FREE
;
}
...
...
@@ -388,6 +402,7 @@ static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, DWORD size )
{
ARENA_FREE
*
pFree
;
char
*
pEnd
;
BOOL
last
;
/* Create a free arena */
mark_block_uninitialized
(
ptr
,
sizeof
(
ARENA_FREE
)
);
...
...
@@ -415,7 +430,8 @@ static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, DWORD size )
/* Set the next block PREV_FREE flag and pointer */
if
((
char
*
)
ptr
+
size
<
(
char
*
)
subheap
+
subheap
->
size
)
last
=
((
char
*
)
ptr
+
size
>=
(
char
*
)
subheap
+
subheap
->
size
);
if
(
!
last
)
{
DWORD
*
pNext
=
(
DWORD
*
)((
char
*
)
ptr
+
size
);
*
pNext
|=
ARENA_FLAG_PREV_FREE
;
...
...
@@ -426,7 +442,7 @@ static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, DWORD size )
/* Last, insert the new block into the free list */
pFree
->
size
=
size
-
sizeof
(
*
pFree
);
HEAP_InsertFreeBlock
(
subheap
->
heap
,
pFree
);
HEAP_InsertFreeBlock
(
subheap
->
heap
,
pFree
,
last
);
}
...
...
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