[#3419] Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...>

Hello list,

19 messages 2004/09/17
[#3422] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3423] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:01, ts wrote:

[#3424] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3425] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:37, ts wrote:

[#3426] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3428] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 13:05, ts wrote:

[#3429] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

Re: [PATCH] dir.c --- Dir.chdir error handling

From: Yukihiro Matsumoto <matz@...>
Date: 2004-09-13 12:39:28 UTC
List: ruby-core #3385
Hi,

In message "Re: [PATCH] dir.c --- Dir.chdir error handling"
    on Mon, 13 Sep 2004 16:54:06 +0900, H.Yamamoto <ocean@m2.ccsnet.ne.jp> writes:

|But I'm still uncomfortable about volatile. ruby is large, I think we cannot
|guarantee all VALUEs are guarded from compiler optimization.
|
|I think the safest way is to store object into volatile variable just after construction.
|
|  volatile VALUE v = rb_str_new2("foo");
|
|  foo(v); /* don't have to think about GC */
|
|but on this policy, we can't do this
|
|  foo(rb_str_new2("foo"));
|
|.... totally.

I'm not sure about your concern.  If the string from rb_str_new()
still used somewhere, it would not be treated as garbage.  The only
problem raises when you retrieve data from a VALUE, and forget about
the original VALUE, e.g.

  VALUE s = rb_str_new2("foo");
  char *ptr = RSTRING(s)->ptr;

  .. no reference to s, but ptr ..

In the cases like this, you must protect your VALUE explicitly (by
volatile), but not for rb_rescue() arguments etc.

							matz.

In This Thread