Commit 79db54e0 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Minor optimisation to the heap manager for performance enhancement.

Detail:
  When splitting a free block in order to satisfy an allocation request,
    don't split if the remaining free space falls below a specified
    threshold (<= 8 bytes) to avoid creating lots of tiny free blocks,
    but instead gift the extra 8 bytes to the newly allocated block.
    This should stop the worst case heap fragmentation seen with OS_Heap
    heaps (particular the Toolbox's dynamic area).
Admin:
  Tested in Ursula desktop build.


Version 5.44. Tagged as 'Kernel-5_44'
parent 9a0d7b54
......@@ -11,14 +11,14 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.43"
Module_Version SETA 543
Module_MajorVersion SETS "5.44"
Module_Version SETA 544
Module_MinorVersion SETS ""
Module_Date SETS "25 May 2001"
Module_ApplicationDate2 SETS "25-May-01"
Module_ApplicationDate4 SETS "25-May-2001"
Module_Date SETS "05 Jun 2001"
Module_ApplicationDate2 SETS "05-Jun-01"
Module_ApplicationDate4 SETS "05-Jun-2001"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.43"
Module_HelpVersion SETS "5.43 (25 May 2001)"
Module_FullVersion SETS "5.44"
Module_HelpVersion SETS "5.44 (05 Jun 2001)"
END
/* (5.43)
/* (5.44)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 5.43
#define Module_MajorVersion_CMHG 5.44
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 25 May 2001
#define Module_Date_CMHG 05 Jun 2001
#define Module_MajorVersion "5.43"
#define Module_Version 543
#define Module_MajorVersion "5.44"
#define Module_Version 544
#define Module_MinorVersion ""
#define Module_Date "25 May 2001"
#define Module_Date "05 Jun 2001"
#define Module_ApplicationDate2 "25-May-01"
#define Module_ApplicationDate4 "25-May-2001"
#define Module_ApplicationDate2 "05-Jun-01"
#define Module_ApplicationDate4 "05-Jun-2001"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "RiscOS/Sources/Kernel"
#define Module_FullVersion "5.43"
#define Module_HelpVersion "5.43 (25 May 2001)"
#define Module_FullVersion "5.44"
#define Module_HelpVersion "5.44 (05 Jun 2001)"
......@@ -109,6 +109,16 @@ freblksize # 0
; They must also be capable of storing a 4 byte size field while allocated.
; This field is used to size the block to free when FreeArea is called.
; This is the threshold for minimum heap block fragmentation size. Splitting a
; free block won't leave a free block which is <= than the size declared here.
; If by choosing to use a particular free block, allocating a new block would
; leave a free block of this size or less, add it on to the original size request
; to avoid generating lots of silly little blocks that slow things down so much.
; This value must not be too large because non-C callers may extend the block
; piecemeal based on their (now wrong) knowledge of the block size. The C library
; reads the block size straight out of the heap block data, and will thus not
; be fooled.
minheapfragsize # 8
ALIGN
......@@ -605,6 +615,14 @@ garloop
SUBS HpTemp, HpTemp, size ; In case this works, for below split
BLO garloop
;
; Try and stop very small blocks appearing due to fragmentation - if we fitted with
; a minimal amount of overhead, pretend we had an exact match
;
CMPNE HpTemp, #minheapfragsize+1 ; set LO if we can salvage this tiny block
ADDLO size, size, HpTemp ; increment the size to encompass the block
MOVLOS HpTemp, #0 ; pretend we fitted exactly, set EQ
; Now addr -> a block on the free space list that our item will fit in
; If we have an exact fit (or as close as the granularity of the free list will
; allow), unlink this block and return it
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment