[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: w32/w64 Emacs and gmalloc()
From: |
Stefan Monnier |
Subject: |
Re: w32/w64 Emacs and gmalloc() |
Date: |
Sat, 01 Mar 2014 10:50:18 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> If Emacs already does that, there's no problem. What Fabrice wrote
> just says that calls to 'free' that reference memory allocated before
> dumping will be a no-op, and calls to 'realloc' that enlarge the block
> will malloc new memory.
That sounds OK. I'm just pointing out that it can be improved a bit by
exposing the "freeable_p" test and use it in sweep_foo so we don't even
try to free blocks when the free would be ignored.
Along the lines of the patch below.
Of course, maybe it's not worth the trouble.
Stefan
=== modified file 'src/alloc.c'
--- src/alloc.c 2014-02-28 21:45:34 +0000
+++ src/alloc.c 2014-03-01 15:48:37 +0000
@@ -1173,7 +1173,8 @@
ABLOCKS_BUSY (abase)
= (struct ablocks *) (-2 + (intptr_t) ABLOCKS_BUSY (abase));
- if (2 > (intptr_t) ABLOCKS_BUSY (abase))
+ if (2 > (intptr_t) ABLOCKS_BUSY (abase)
+ && freeable_p ABLOCKS_BASE (abase))
{ /* All the blocks are free. */
int i = 0, aligned = (intptr_t) ABLOCKS_BUSY (abase);
struct ablock **tem = &free_ablock;
@@ -1884,7 +1885,8 @@
/* Free blocks that contain free Lisp_Strings only, except
the first two of them. */
if (nfree == STRING_BLOCK_SIZE
- && total_free_strings > STRING_BLOCK_SIZE)
+ && total_free_strings > STRING_BLOCK_SIZE
+ && freeable_p (b))
{
lisp_free (b);
string_free_list = free_list_before;