This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PowerPC malloc alignment


On Wed, Oct 31, 2007 at 02:36:48PM -0700, Roland McGrath wrote:
> > The main problem is emacs (aka the only user of
> > malloc_set_state/malloc_get_state).  Changing the alignment is really an ABI
> > change for these interfaces, unless it does some very ugly hacks in it.
> 
> That can at least be made easy to detect gracefully via magic/version.  
> Is it pathologically difficult to cope with an old dumped state?

Tricky, at least.  The alignment has to be a constant or we're going
to penalize performance all across the board.  And it is used
indirectly to size some arrays, e.g. via NFASTBINS.

I tried just ignoring malloc_set_state, to see if emacs does something
graceful.  It does not check for failure and immediately frees the
saved state, so it crashes.  If I forcibly skip both the call to
malloc_set_state and the following free, things seem to work OK but
malloc checking reveals it will happily realloc() pointers from the
saved heap.  So that won't help either.

I see two ways to increase the alignment.

  - Build a second set of malloc routines with the old alignment.  At
    malloc_set_state time, install them as hooks if necessary.

  - Tell people to rebuild emacs.  Improve the crash by adding a
    debugging message out of malloc_set_state when it detects the
    problem.

You can guess which one of these I like better.  I doubt that anything
besides Emacs uses malloc_set_state.  Some older librep may have, but
nowadays it has only the vestigial configure check.  The only other
references I could find were programs using malloc_get_state to peek
at statistics, and they won't be affected anyway.

Let me know if you think we need the hooks approach.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]