From 9b87881affde6c89ab5f0003fee4a7f27ae056ca Mon Sep 17 00:00:00 2001 From: megane Date: Thu, 20 Jun 2019 10:14:50 +0300 Subject: [PATCH] Fix memory-statistics Fixes #1540 Signed-off-by: Peter Bex --- NEWS | 7 +++++++ library.scm | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index aa5f1d14..6819856a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +5.1.1 + +- Core libraries + - Fix `memory-statistics` by returning semi-space bytes and used + semi-space bytes like the documentation says. Old implementation + returned full-heap size and (full-heap - used-semi-space). + 5.1.0 - Core libraries diff --git a/library.scm b/library.scm index b7d0c10e..80d76579 100644 --- a/library.scm +++ b/library.scm @@ -6020,8 +6020,8 @@ static C_word C_fcall C_setenv(C_word x, C_word y) { (define (memory-statistics) (let* ((free (##sys#gc #t)) (info (##sys#memory-info)) - (hsize (##sys#slot info 0))) - (vector hsize (fx- hsize free) (##sys#slot info 1)))) + (half-size (fx/ (##sys#slot info 0) 2))) + (vector half-size (fx- half-size free) (##sys#slot info 1)))) ;;; Finalization: -- 2.11.0