[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Improve heap shrinkage calculation
From: |
felix . winkelmann |
Subject: |
Re: [PATCH] Improve heap shrinkage calculation |
Date: |
Sun, 01 Dec 2019 23:22:37 +0100 |
> Hi all,
>
> As suggested by Sven Hartrumpf in #1379, the current logic which
> decides when the heap should be shrunk is confusing and looks
> "obviously wrong".
>
> For one, the "count" variable indicates the actual used memory.
> This is in one half of the heap, so it seems incorrect to me to
> calculate the watermark on the full heap size (which is what the
> current code does). And taking a percentage of a percentage seems
> wrong as well.
>
> The attached patch fixes the code as suggested by Sven and adds
> a parameter to allow the user to tweak the low watermark as well.
It seems to work fine, but "-:hs0" doesn't seem to work. I tried
csi -:d -:hs0
> (define x (make-vector 10000000))
> (##sys#gc)
> (##sys#gc)
> ...
The heap is still shrunk on each GC. "-:hs100" works, but isn't really
useful, as it resizes the heap to the previous value.
felix