bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16901: 24.3.50; emacs_backtrace.txt


From: Eli Zaretskii
Subject: bug#16901: 24.3.50; emacs_backtrace.txt
Date: Tue, 04 Mar 2014 19:37:15 +0200

> Date: Tue, 04 Mar 2014 09:23:39 -0500
> From: Ken Brown <address@hidden>
> CC: address@hidden, address@hidden, address@hidden
> 
> On 3/3/2014 10:45 PM, Eli Zaretskii wrote:
> >> Date: Mon, 03 Mar 2014 18:20:09 -0500
> >> From: Ken Brown <address@hidden>
> >> CC: address@hidden, address@hidden
> >>
> >> If adj == 0 in line 1596, then we've allocated much more memory than
> >> we needed, and the next call to malloc (line 1602) allocates even
> >> more.  And if adj == 1 in line 1596, then we've allocated exactly as
> >> much memory as we needed, so there's no need to call malloc again in
> >> line 1602.
> >
> > Thanks for reviewing.
> >
> > These are further optimizations, and can (and probably should) be done
> > in separate commits.

Now done in trunk revision 16661.

> > But you aren't saying that the previous code was correct, are you?
> 
> No, I think it was clearly wrong.  By accident, however, it probably 
> worked most of the time and didn't waste memory, since adj is usually 0.

Yes, when the initial allocation was already aligned, it worked OK.

> When/if you do the optimizations I suggested, I think it would clarify 
> the code if `adj' were used to represent the actual adjustment needed, 
> something like this:
> 
>    adj = (uintptr_t) alignment - result % alignment;
>    if (adj == alignment)
>      adj = 0;

I didn't make this change, but feel free to follow up.

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]