[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building Emacs overflowed pure space
From: |
mituharu |
Subject: |
Re: Building Emacs overflowed pure space |
Date: |
Wed, 19 Jul 2006 22:52:15 +0900 (JST) |
User-agent: |
SquirrelMail/1.4.5-1_rh7x |
>> I don't think it's reasonable at this stage. We are not supposed to
>> install changes that increase the pure size significantly; adding 10K
>> will just risk wasting memory in the released Emacs.
>
> I'm not sure what size other people get, but my `emacs' binary is never
> smaller than 2MB (by a long shot), so even if one counts the worst case
> 20KB of wasted space (10KB * 2 (64bit growth factor)), it's still less
> than
> 1%. Not much to worry about. If we really care about that kind of
> memory,
> we can do as XEmacs did: dump once to see how much pure space is
> necessary,
> than adjust pure size and redump.
>
> I use here a local hack which saves more pure space than that by simply
> using a more compact representation for strings. I haven't installed it
> because I'm not convinced it's worth the trouble (it's more interesting on
> 64bit systems, tho). See patch hunk below to get a feel for it ;-)
Does it make sense to allocate Lisp objects (with alignment)
forward from the beginning and non-Lisp objects (without
alignment) backward from the end in the pure storage? If the
following patch correct, pure-bytes-used decreases by ~70KB.
YAMAMOTO Mitsuharu
address@hidden
Index: src/alloc.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/alloc.c,v
retrieving revision 1.396
diff -c -p -r1.396 alloc.c
*** src/alloc.c 18 Jul 2006 13:25:40 -0000 1.396
--- src/alloc.c 19 Jul 2006 13:36:31 -0000
*************** static size_t pure_bytes_used_before_ove
*** 289,298 ****
&& ((PNTR_COMPARISON_TYPE) (P) ?
>= (PNTR_COMPARISON_TYPE) purebeg))
! /* Index in pure at which next pure object will be allocated.. */
EMACS_INT pure_bytes_used;
/* If nonzero, this is a warning delivered by malloc and not yet
displayed. */
--- 289,306 ----
&& ((PNTR_COMPARISON_TYPE) (P) ?
>= (PNTR_COMPARISON_TYPE) purebeg))
! /* Total number of bytes allocated in pure storage. */
EMACS_INT pure_bytes_used;
+ /* Index in pure at which next pure Lisp object will be allocated.. */
+
+ static EMACS_INT pure_bytes_used_lisp;
+
+ /* Number of bytes allocated for non-Lisp objects in pure storage. */
+
+ static EMACS_INT pure_bytes_used_non_lisp;
+
/* If nonzero, this is a warning delivered by malloc and not yet
displayed. */
*************** pure_alloc (size, type)
*** 4720,4727 ****
#endif
again:
! result = ALIGN (purebeg + pure_bytes_used, alignment);
! pure_bytes_used = ((char *)result - (char *)purebeg) + size;
if (pure_bytes_used <= pure_size)
return result;
--- 4728,4746 ----
#endif
again:
! if (type >= 0)
! {
! /* Lisp object. */
! result = ALIGN (purebeg + pure_bytes_used_lisp, alignment);
! pure_bytes_used_lisp = ((char *)result - (char *)purebeg) + size;
! }
! else
! {
! /* Non-Lisp object. */
! pure_bytes_used_non_lisp += size;
! result = purebeg + pure_size - pure_bytes_used_non_lisp;
! }
! pure_bytes_used = pure_bytes_used_lisp + pure_bytes_used_non_lisp;
if (pure_bytes_used <= pure_size)
return result;
*************** pure_alloc (size, type)
*** 4733,4738 ****
--- 4752,4758 ----
pure_size = 10000;
pure_bytes_used_before_overflow += pure_bytes_used - size;
pure_bytes_used = 0;
+ pure_bytes_used_lisp = pure_bytes_used_non_lisp = 0;
goto again;
}
*************** init_alloc_once ()
*** 6225,6230 ****
--- 6245,6251 ----
purebeg = PUREBEG;
pure_size = PURESIZE;
pure_bytes_used = 0;
+ pure_bytes_used_lisp = pure_bytes_used_non_lisp = 0;
pure_bytes_used_before_overflow = 0;
/* Initialize the list of free aligned blocks. */
- Re: Building Emacs overflowed pure space, (continued)
- Re: Building Emacs overflowed pure space, Mathias Dahl, 2006/07/18
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/18
- Re: Building Emacs overflowed pure space, Luc Teirlinck, 2006/07/18
- Re: Building Emacs overflowed pure space, Eli Zaretskii, 2006/07/18
- Re: Building Emacs overflowed pure space, Stefan Monnier, 2006/07/18
- Re: Building Emacs overflowed pure space, Eli Zaretskii, 2006/07/18
- Re: Building Emacs overflowed pure space, Stefan Monnier, 2006/07/19
- Re: Building Emacs overflowed pure space, Miles Bader, 2006/07/19
- Re: Building Emacs overflowed pure space, Eli Zaretskii, 2006/07/19
- Re: Building Emacs overflowed pure space,
mituharu <=
- Re: Building Emacs overflowed pure space, Stefan Monnier, 2006/07/19
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/19
- Re: Building Emacs overflowed pure space, YAMAMOTO Mitsuharu, 2006/07/19
- Re: Building Emacs overflowed pure space, YAMAMOTO Mitsuharu, 2006/07/22
- Re: Building Emacs overflowed pure space, Stefan Monnier, 2006/07/22
- Re: Building Emacs overflowed pure space, Kim F. Storm, 2006/07/22
- Re: Building Emacs overflowed pure space, Stefan Monnier, 2006/07/22
- Re: Building Emacs overflowed pure space, YAMAMOTO Mitsuharu, 2006/07/24
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/25
- Re: Building Emacs overflowed pure space, YAMAMOTO Mitsuharu, 2006/07/25