emacs-devel
[Top][All Lists]
Advanced

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

Re: EMACS and valgrind


From: Stefan Monnier
Subject: Re: EMACS and valgrind
Date: 22 Jan 2004 17:26:30 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>> Well, with my USE_LSB_TAG patch, you might be able to go a bit further
>> since it does not assume that malloc returns blocks of memory close to
>> address 0 (instead it assumes the blocks are aligned on 8byte boundaries).

> Well, I've rebuilt Emacs with make "MYCPPFLAGS=-DUSE_LSB_TAG". Is that right?
> Valgrind complains that the memory is exhausted again, but from a different
> location in the Emacs code (shown below). To give me a handle on this matter,
> can you please provide a bit of background to this patch?

The patch changes the place where tag bits are kept in Lisp_Object values.
I.e. instead of using the top 3 bits (so we can only use pointers whose
values are smaller than 2^29) it now uses the low 3 bits (so we can use
pointers that point anywhere within the address space so long as they are
aligned on an 8-byte boundary).

Now, I have no idea whether the problem you se without USE_LSB_TAG is due to
the fact that valgrind uses a malloc implementation that returns pointers
whose value is larger than 2^29, but it seemed like a possible cause.

> ==2395== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
> ==2395== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
> ==2395== Using valgrind-2.0.0, a program supervision framework for x86-linux.
> ==2395== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
> ==2395== Estimated CPU clock rate is 200 MHz
> ==2395== For more details, rerun with: -v
> ==2395== 
> ==2395== Invalid free() / delete / delete[]
> ==2395==    at 0x4002668F: realloc (vg_replace_malloc.c:310)
> ==2395==    by 0x812E694: xrealloc (alloc.c:547)
> ==2395==    by 0x81267BE: regex_compile (regex.c:2721)
> ==2395==    by 0x812D8BF: re_compile_pattern (regex.c:5997)
> ==2395==    Address 0x8575778 is not stack'd, malloc'd or free'd
> ==2395== 
> ==2395== Invalid free() / delete / delete[]
> ==2395==    at 0x400263A8: free (vg_replace_malloc.c:231)
> ==2395==    by 0x812E595: memory_full (alloc.c:478)
> ==2395==    by 0x812E6D8: xrealloc (alloc.c:552)
> ==2395==    by 0x81267BE: regex_compile (regex.c:2721)
> ==2395==    Address 0x83D2F60 is not stack'd, malloc'd or free'd
> emacs: Memory exhausted--use M-x save-some-buffers then exit and restart Emacs

This does not look like exhausted memory but rather looks like corruption
(c.f. "Invalid free").


        Stefan




reply via email to

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