[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Fix memory-statistics
From: |
megane |
Subject: |
[Chicken-hackers] [PATCH] Fix memory-statistics |
Date: |
Thu, 20 Jun 2019 10:22:35 +0300 |
User-agent: |
mu4e 1.0; emacs 25.1.1 |
Hi,
I think the docs are saying the returned values should be
semi-space-size, used-semi-space and nursery size. The patch makes it so.
>From 9034923bf13216db9c9b2362bd0ca6ff1d4b92d3 Mon Sep 17 00:00:00 2001
From: megane <address@hidden>
Date: Thu, 20 Jun 2019 10:14:50 +0300
Subject: [PATCH] Fix memory-statistics
Fixes #1540
---
NEWS | 6 ++++++
library.scm | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index aa5f1d14..e8f6c7e7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+5.2.0
+- 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.17.1
- [Chicken-hackers] [PATCH] Fix memory-statistics,
megane <=