unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 22526@debbugs.gnu.org, andrewjmoreton@gmail.com
Subject: bug#22526: 25.0.90; Crash starting gnus
Date: Sun, 14 Feb 2016 22:41:43 +0100	[thread overview]
Message-ID: <CAFgFV9NV+48c6aaLiCdNhk21ERpudvJf9s=kxhe9bE0H2XPR6w@mail.gmail.com> (raw)
In-Reply-To: <83twlbx9gp.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 2103 bytes --]

As vmmap shows it, the next region is unusable.
The reserved region is 4k and the 60k after are lost.

I think it is worth to try that :

diff --git a/src/w32heap.c b/src/w32heap.c
index 69706a3..db14357 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -641,12 +641,12 @@ mmap_alloc (void **var, size_t nbytes)
      advance, and the buffer is enlarged several times as the data is
      decompressed on the fly.  */
   if (nbytes < MAX_BUFFER_SIZE)
-    p = VirtualAlloc (NULL, (nbytes * 2), MEM_RESERVE, PAGE_READWRITE);
+    p = VirtualAlloc (NULL, ROUND_UP((nbytes * 2), get_allocation_unit()),
MEM_RESERVE, PAGE_READWRITE);

   /* If it fails, or if the request is above 512MB, try with the
      requested size.  */
   if (p == NULL)
-    p = VirtualAlloc (NULL, nbytes, MEM_RESERVE, PAGE_READWRITE);
+    p = VirtualAlloc (NULL, ROUND_UP(nbytes, get_allocation_unit()),
MEM_RESERVE, PAGE_READWRITE);

   if (p != NULL)
     {

because running with it, vmmap shows now :

[image: Images intégrées 1]

and you see the 64k block is reserved, the first 4k are commited and the
next 60k are usable.
Anyway, it is more correct with this patch than without it.

Fabrice

2016-02-14 22:34 GMT+01:00 Eli Zaretskii <eliz@gnu.org>:

> > From: Fabrice Popineau <fabrice.popineau@gmail.com>
> > Date: Sun, 14 Feb 2016 22:04:39 +0100
> > Cc: andrewjmoreton@gmail.com, 22526@debbugs.gnu.org
> >
> > Also vmmap reports a 4k block committed at 0x1F0000. If I ask vmmap to
> display free/unusable blocks,
> > it reports 0x1F1000 as unusable, size 60k and committed 60k. The problem
> is that the first block has been
> > allocated with 4k, so the next 60k are unusable. We should allocate by
> block by allocation granularity
> > as reported by GetSystemInfo().
>
> Actually... are you saying this explains Andrew's problem in some way?
> I cannot see how, because in that case we requested less than 1 page
> in the next region, so if even 4KB (one page) was available there, the
> call to VirtualAlloc to commit that chunk should have succeeded.  No?
>

[-- Attachment #1.2: Type: text/html, Size: 3040 bytes --]

[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 158886 bytes --]

  reply	other threads:[~2016-02-14 21:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 22:13 bug#22526: 25.0.90; Crash starting gnus Andy Moreton
2016-02-07  5:42 ` Lars Ingebrigtsen
2016-02-07 16:00   ` Eli Zaretskii
2016-02-07 20:58     ` Andy Moreton
2016-02-07 21:05       ` Eli Zaretskii
2016-02-11  2:06         ` Andy Moreton
2016-02-11 20:27           ` Eli Zaretskii
2016-02-11 21:20             ` Andy Moreton
2016-02-11 21:26               ` Eli Zaretskii
2016-02-12 13:34                 ` Andy Moreton
2016-02-12 16:16                   ` Eli Zaretskii
2016-02-12 22:26                     ` Andy Moreton
2016-02-13  8:28                       ` Eli Zaretskii
2016-02-13 10:44                         ` Eli Zaretskii
2016-02-13 16:08                           ` Fabrice Popineau
2016-02-13 16:42                             ` Eli Zaretskii
2016-02-13 21:35                               ` Fabrice Popineau
2016-02-13 22:11                                 ` Eli Zaretskii
2016-02-13 23:44                                   ` Fabrice Popineau
2016-02-14  5:49                                     ` Eli Zaretskii
2016-02-14  9:05                                       ` Fabrice Popineau
2016-02-14 16:57                                         ` Eli Zaretskii
2016-02-14  5:41                                   ` Eli Zaretskii
2016-02-14 14:17                                     ` Andy Moreton
2016-02-14 16:55                                       ` Eli Zaretskii
2016-02-14 17:51                                         ` Eli Zaretskii
2016-02-14 21:04                                           ` Fabrice Popineau
2016-02-14 21:29                                             ` Eli Zaretskii
2016-02-14 21:31                                               ` Fabrice Popineau
2016-02-14 21:34                                             ` Eli Zaretskii
2016-02-14 21:41                                               ` Fabrice Popineau [this message]
2016-02-15  3:32                                                 ` Eli Zaretskii
2016-02-15  8:09                                                   ` Fabrice Popineau
2016-02-15 11:39                                                     ` Eli Zaretskii
2016-02-13 15:16                         ` Andy Moreton
2016-02-13 15:52                           ` Eli Zaretskii
2016-02-13 21:26                             ` Andy Moreton
2016-02-16  1:18                               ` Andy Moreton
2016-02-16  3:46                                 ` Eli Zaretskii
2016-02-20 11:08                                   ` Eli Zaretskii
2016-02-20 16:17                                     ` Andy Moreton
2016-02-20 17:01                                       ` 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='CAFgFV9NV+48c6aaLiCdNhk21ERpudvJf9s=kxhe9bE0H2XPR6w@mail.gmail.com' \
    --to=fabrice.popineau@gmail.com \
    --cc=22526@debbugs.gnu.org \
    --cc=andrewjmoreton@gmail.com \
    --cc=eliz@gnu.org \
    /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).