mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-08 13:10:19 +02:00
Don't release shared worklist buffers when less than 256 kB
Fixes https://github.com/wingo/whippet/issues/8.
This commit is contained in:
parent
7984f60eae
commit
cf570d0206
1 changed files with 5 additions and 2 deletions
|
@ -29,6 +29,8 @@ struct shared_worklist_buf {
|
||||||
// Max size: 2 GB on 64-bit systems, 1 GB on 32-bit.
|
// Max size: 2 GB on 64-bit systems, 1 GB on 32-bit.
|
||||||
#define shared_worklist_buf_max_log_size ((unsigned) 28)
|
#define shared_worklist_buf_max_log_size ((unsigned) 28)
|
||||||
|
|
||||||
|
static const size_t shared_worklist_release_byte_threshold = 256 * 1024;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
shared_worklist_buf_init(struct shared_worklist_buf *buf, unsigned log_size) {
|
shared_worklist_buf_init(struct shared_worklist_buf *buf, unsigned log_size) {
|
||||||
ASSERT(log_size >= shared_worklist_buf_min_log_size);
|
ASSERT(log_size >= shared_worklist_buf_min_log_size);
|
||||||
|
@ -59,8 +61,9 @@ shared_worklist_buf_byte_size(struct shared_worklist_buf *buf) {
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shared_worklist_buf_release(struct shared_worklist_buf *buf) {
|
shared_worklist_buf_release(struct shared_worklist_buf *buf) {
|
||||||
if (buf->data)
|
size_t byte_size = shared_worklist_buf_byte_size(buf);
|
||||||
madvise(buf->data, shared_worklist_buf_byte_size(buf), MADV_DONTNEED);
|
if (buf->data && byte_size >= shared_worklist_release_byte_threshold)
|
||||||
|
madvise(buf->data, byte_size, MADV_DONTNEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue