unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>, Chong Yidong <cyd@gnu.org>,
	Andreas Schwab <schwab@linux-m68k.org>,
	emacs-devel@gnu.org
Subject: Re: valgrind warnings [Re: Emacs bzr memory footprint]
Date: Fri, 04 Nov 2011 15:10:11 -0400	[thread overview]
Message-ID: <yxqk47fya98.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <jwvk47fbxl2.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 04 Nov 2011 13:37:03 -0400")

[-- Attachment #1: Type: text/plain, Size: 2006 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>>> This is while scanning the stack, where it is apparently possible that
>>>> this happens to look like a Lisp_Object, but isn't.
>>> That doesn't explain it, tho: the conservative stack scanning does check
>>> to make sure the suspected pointer really does point to a real (tho
>>> possibly dead) object, and we always know its type.
>> It turns out there's a --track-origins=yes valgrind flag.  With that
>> turned on we get this warning:
>
>> ==9622== Conditional jump or move depends on uninitialised value(s)
>> ==9622==    at 0x5B3D89: mem_find (alloc.c:3521)
>> ==9622==    by 0x5B4AEB: mark_maybe_object (alloc.c:4103)
>> ==9622==    by 0x5B50E6: mark_memory (alloc.c:4275)
>> ==9622==    by 0x5B517E: mark_stack (alloc.c:4533)
>> ==9622==    by 0x5B6048: Fgarbage_collect (alloc.c:5120)
>> ==9622==    by 0x5D542C: eval_sub (eval.c:2217)
>> ==9622==    by 0x602A0B: readevalloop (lread.c:1838)
>> ==9622==    by 0x6015B6: Fload (lread.c:1316)
>> ==9622==    by 0x5D59FF: eval_sub (eval.c:2336)
>> ==9622==    by 0x602A0B: readevalloop (lread.c:1838)
>> ==9622==    by 0x6015B6: Fload (lread.c:1316)
>> ==9622==    by 0x5D59FF: eval_sub (eval.c:2336)
>> ==9622==  Uninitialised value was created by a stack allocation
>> ==9622==    at 0x5B5D00: Fgarbage_collect (alloc.c:4993)
>> ==9622== 
>
>> And indeed, there's:
>>   Lisp_Object total[8];
>> in Fgarbage_collect.
>
> Ah, right, so the problem is not that the stack "points" to some
> uninitialized value, but that the stack itself contains uninitialized
> values.  Yes, that's perfectly harmless (at least no worse than the
> arbitrary initialized values we can find).
>
>> What should we do about this?
>
> Tell valgrind that it's a non-issue.

There is a way to do that, write a configuration file and pass it to
valgrind with:  --suppressions=FILENAME

Such a file is attached.

I think it should be checked in src/ so that everyone can make use of it
and improve it.  OK to check in?


[-- Attachment #2: valgrind.supp --]
[-- Type: text/plain, Size: 1242 bytes --]

# valgrind supression file
# generated on a x86_64-unknown-linux-gnu machine
# Usage:
#    valgrind --suppressions=valgrind.supp ./temacs

# This looks like this:
# Invalid read of size 4
#    at 0x511B3C: init_buffer (buffer.c:5037)
#    by 0x40E293: main (emacs.c:1452)
#  Address 0x50cff24 is 68 bytes inside a block of size 70 alloc'd
#    at 0x4A06582: realloc (vg_replace_malloc.c:525)
#    by 0x511B23: init_buffer (buffer.c:5071)
#    by 0x40E293: main (emacs.c:1452)
#
# It is due to the optimized strlen implementation that loads 32 bits at a time.
{
   optimized_strlen_in_init_buffer
   Memcheck:Addr4
   fun:init_buffer
   fun:main
}

# Disable various warnings due to garbage collection scanning the stack.
{
   <GCcond>
   Memcheck:Cond
   fun:Fgarbage_collect
   fun:*
}
{
   <GCvalue>
   Memcheck:Value8
   fun:Fgarbage_collect
   fun:*
}
{
   <mark>
   Memcheck:Value8
   fun:mark_object
   fun:*
}
{
   mark_object_cond
   Memcheck:Cond
   fun:mark_object
   fun:*
}
{
   mark_vectorlike_value8
   Memcheck:Value8
   fun:mark_vectorlike
   fun:Fgarbage_collect
   fun:*
}
{
   survives_gc_p_cond
   Memcheck:Cond
   fun:survives_gc_p
   fun:sweep_weak_table
   fun:sweep_weak_hash_tables
   fun:Fgarbage_collect
   fun:*
}

  reply	other threads:[~2011-11-04 19:10 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13  9:24 Emacs bzr memory footprint Carsten Mattner
2011-10-13 10:01 ` Eli Zaretskii
2011-10-13 10:33   ` Andreas Schwab
2011-10-13 10:46     ` Eli Zaretskii
2011-10-13 13:08       ` Carsten Mattner
2011-10-13 13:38         ` Eli Zaretskii
2011-10-13 15:22           ` Miles Bader
2011-10-13 15:30             ` Eli Zaretskii
2011-10-13 16:16               ` Stefan Monnier
2011-10-13 17:33                 ` Dmitry Antipov
2011-10-13 18:42                   ` Eli Zaretskii
2011-10-14  3:09                     ` Dmitry Antipov
2011-10-13 16:46             ` Stephen J. Turnbull
2011-10-13 16:59               ` Carsten Mattner
2011-10-13 13:13   ` Carsten Mattner
2011-10-13 13:43     ` Eli Zaretskii
2011-10-13 14:10       ` Dave Abrahams
2011-10-13 14:46         ` Eli Zaretskii
2011-10-13 15:05           ` Dave Abrahams
2011-10-13 14:22       ` Stefan Monnier
2011-10-13 16:55         ` Carsten Mattner
2011-10-13 17:09           ` Stefan Monnier
2011-10-14 12:11             ` Carsten Mattner
2011-10-14 21:02             ` John Wiegley
2011-10-15  1:22               ` Stefan Monnier
2011-10-13 17:22           ` Richard Riley
2011-10-13 16:12       ` Chong Yidong
2011-10-13 20:18     ` chad
2011-10-14 12:13       ` Carsten Mattner
2011-10-14 12:18         ` Carsten Mattner
2011-10-14 15:49           ` Sven Joachim
2011-10-14 16:30             ` Ted Zlatanov
2011-10-14 16:48               ` Sven Joachim
2011-10-14 17:16                 ` Carsten Mattner
2011-10-15 18:12                 ` Sven Joachim
2011-10-20 13:35                 ` Nix
2011-10-20 23:02                   ` John Wiegley
2011-10-21  0:19                     ` Nix
2011-10-21  8:19                       ` Eli Zaretskii
2011-10-21 12:05                         ` Nix
2011-10-21 12:36                           ` Eli Zaretskii
2011-10-21 12:47                             ` Nix
2011-10-21 14:30                               ` Dmitry Antipov
2011-10-21 15:22                                 ` Nix
2011-10-21 18:29                                   ` Dmitry Antipov
2011-10-21 18:36                                     ` Nix
2011-10-21 13:30                       ` Stefan Monnier
2011-10-21 15:02                         ` Nix
2011-10-21 17:52                           ` Stefan Monnier
2011-10-21 19:12                             ` Nix
2011-10-21 15:34                         ` Dmitry Antipov
2011-10-21 18:00                           ` Stefan Monnier
2011-10-21 18:27                             ` Óscar Fuentes
2011-10-21 18:58                               ` Eli Zaretskii
2011-10-21 19:11                               ` Nix
2011-10-21 20:18                                 ` Eli Zaretskii
2011-10-21 20:21                                   ` Nix
2011-10-22  7:34                             ` Carsten Mattner
2011-10-22  8:30                               ` Stephen J. Turnbull
2011-10-22 12:03                                 ` Carsten Mattner
2011-10-22 16:08                                   ` Stephen J. Turnbull
2011-10-27 22:10                                     ` Ted Zlatanov
2011-10-28  6:40                                       ` Eli Zaretskii
2011-10-28  9:34                                         ` Stephen J. Turnbull
2011-10-28  9:47                                           ` Eli Zaretskii
2011-10-28 10:22                                             ` Stephen J. Turnbull
2011-10-28 10:36                                               ` Eli Zaretskii
2011-10-28 11:52                                                 ` valgrind warnings [Re: Emacs bzr memory footprint] Dan Nicolaescu
2011-10-28 14:08                                                   ` Stephen J. Turnbull
2011-10-28 14:38                                                   ` Dan Nicolaescu
2011-10-28 15:17                                                     ` Chong Yidong
2011-10-28 15:35                                                       ` Eli Zaretskii
2011-10-28 15:27                                                     ` Eli Zaretskii
2011-10-28 16:34                                                       ` Dan Nicolaescu
2011-10-28 18:36                                                         ` Eli Zaretskii
2011-10-28 18:51                                                           ` Eli Zaretskii
2011-10-28 18:52                                                           ` Dan Nicolaescu
2011-10-28 19:03                                                             ` Eli Zaretskii
2011-10-28 15:08                                                   ` Ted Zlatanov
2011-12-04 21:11                                                     ` Florian Weimer
2011-10-28 20:20                                                   ` Dan Nicolaescu
2011-10-29  3:40                                                     ` Chong Yidong
2011-10-29  7:04                                                       ` Andreas Schwab
2011-10-29 16:25                                                         ` Stefan Monnier
2011-11-04 12:51                                                           ` Dan Nicolaescu
2011-11-04 13:08                                                             ` Andreas Schwab
2011-11-04 15:50                                                             ` valgrind warnings Paul Eggert
2011-11-04 17:37                                                             ` valgrind warnings [Re: Emacs bzr memory footprint] Stefan Monnier
2011-11-04 19:10                                                               ` Dan Nicolaescu [this message]
2011-11-04 20:56                                                                 ` Paul Eggert
2011-11-05 22:08                                                                   ` Dan Nicolaescu
2011-11-06  2:34                                                                     ` Paul Eggert
2011-11-06 12:37                                                                       ` Dan Nicolaescu
2011-11-07  1:13                                                                         ` Paul Eggert
2011-10-29  9:10                                                     ` Eli Zaretskii
2011-10-22  8:44                               ` Emacs bzr memory footprint Sven Joachim
2011-10-22 11:57                                 ` Carsten Mattner
2011-10-23 18:04                               ` Stefan Monnier
2011-10-25 17:35                         ` Nix
2011-10-25 20:23                           ` Stefan Monnier
2011-10-25 20:34                             ` Nix
2011-10-26 14:52                             ` gnutls memory leak [Was: Re: Emacs bzr memory footprint] Chong Yidong
2011-10-27  6:10                               ` Chong Yidong
2011-10-27 22:01                                 ` Ted Zlatanov
2011-10-28 12:04                                   ` Ted Zlatanov
2011-10-28 17:29                                     ` Nix
2011-10-27 22:03                               ` Ted Zlatanov
2011-10-13 21:23 ` Emacs bzr memory footprint Dan Nicolaescu
2011-10-14 13:04 ` Carsten Mattner
2011-10-14 18:13 ` James Cloos
2011-10-17 20:52   ` Juri Linkov
2011-10-17 23:34     ` James Cloos
2011-10-18  7:24       ` Andreas Schwab

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=yxqk47fya98.fsf@fencepost.gnu.org \
    --to=dann@gnu.org \
    --cc=cyd@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=schwab@linux-m68k.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).