unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ken Brown <kbrown@cornell.edu>
Cc: 16901@debbugs.gnu.org, lekktu@gmail.com, dmantipov@yandex.ru
Subject: bug#16901: 24.3.50; emacs_backtrace.txt
Date: Tue, 04 Mar 2014 19:37:15 +0200	[thread overview]
Message-ID: <8361ntsw50.fsf@gnu.org> (raw)
In-Reply-To: <5315E1EB.8060404@cornell.edu>

> Date: Tue, 04 Mar 2014 09:23:39 -0500
> From: Ken Brown <kbrown@cornell.edu>
> CC: lekktu@gmail.com, 16901@debbugs.gnu.org, dmantipov@yandex.ru
> 
> On 3/3/2014 10:45 PM, Eli Zaretskii wrote:
> >> Date: Mon, 03 Mar 2014 18:20:09 -0500
> >> From: Ken Brown <kbrown@cornell.edu>
> >> CC: 16901@debbugs.gnu.org, dmantipov@yandex.ru
> >>
> >> 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	other threads:[~2014-03-04 17:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<e42ac7ca-f017-406a-a5f5-a3dd6e096e4e@default>
     [not found] ` <<CAAeL0SRsO74PW6SqBPOXEy4OTuH4R4MrfwrpthkdT8s=s6oaDw@mail.gmail.com>
     [not found]   ` <<83y50uv17m.fsf@gnu.org>
2014-03-01 17:42     ` bug#16901: 24.3.50; emacs_backtrace.txt Drew Adams
2014-03-01 18:26       ` Eli Zaretskii
2014-03-02  4:16         ` Juanma Barranquero
2014-03-02 17:00           ` Eli Zaretskii
2014-03-02 20:45             ` Juanma Barranquero
2014-03-03 16:54             ` Eli Zaretskii
2014-03-03 17:28               ` Juanma Barranquero
2014-03-03 17:42                 ` Eli Zaretskii
2014-03-03 17:57                   ` Juanma Barranquero
2014-03-03 23:20               ` Ken Brown
2014-03-04  3:45                 ` Eli Zaretskii
2014-03-04 14:23                   ` Ken Brown
2014-03-04 17:37                     ` Eli Zaretskii [this message]
2014-03-04 19:04                       ` Ken Brown
     [not found] <<b93ed3b6-293d-44cd-959a-3933ccb4bcae@default>
     [not found] ` <<831tylvkq2.fsf@gnu.org>
2014-03-01 18:40   ` Drew Adams
     [not found] <<5d9f431d-d0c3-4cfa-b9e5-07cdf6718d5a@default>
     [not found] ` <<CAAeL0SRkM1gmNDJXkkrgZTCVohhGZeGgkyNDTojFx1GfzvM4RA@mail.gmail.com>
     [not found]   ` <<83mwhbwm9j.fsf@gnu.org>
     [not found]     ` <<53107F45.3060502@yandex.ru>
     [not found]       ` <<83d2i7wbyc.fsf@gnu.org>
2014-02-28 16:00         ` Drew Adams
2014-02-28 17:12           ` Juanma Barranquero
2014-03-01  7:15             ` Eli Zaretskii
2014-02-28  4:56 Drew Adams
2014-02-28  9:41 ` Juanma Barranquero
2014-02-28 10:43   ` Eli Zaretskii
2014-02-28 10:48     ` Juanma Barranquero
2014-02-28 11:41       ` Eli Zaretskii
2014-02-28 12:27         ` Juanma Barranquero
2014-02-28 15:00       ` Drew Adams
2014-02-28 12:21     ` Dmitry Antipov
2014-02-28 14:26       ` Eli Zaretskii
2014-02-28 15:44         ` Dmitry Antipov
     [not found]         ` <5310AEEE.4070005@yandex.ru>
2014-02-28 21:12           ` Paul Eggert
2014-03-01  8:47           ` Eli Zaretskii
     [not found]           ` <83k3ceuwz1.fsf@gnu.org>
2014-03-01 10:12             ` Juanma Barranquero
     [not found]             ` <CAAeL0SSbTVLNb5S-FnzgT+48j_U2VJ5RirU_w9U6nFN8_x=hUQ@mail.gmail.com>
2014-03-01 10:46               ` Juanma Barranquero
     [not found]               ` <CAAeL0SQoHu16GkCG=k1Kcsz5rxqRxOrFr3o6TFwp32zUQ_W84A@mail.gmail.com>
2014-03-01 11:57                 ` Eli Zaretskii
     [not found]                 ` <83d2i6uo5g.fsf@gnu.org>
2014-03-01 13:12                   ` Juanma Barranquero
2014-03-20 18:31           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8361ntsw50.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=16901@debbugs.gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=kbrown@cornell.edu \
    --cc=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).