thread_pthread.c: get current main thread stack size
* thread_pthread.c: get current main thread stack size, which may be expanded than allocated size at initialization, by rlimit(). [ruby-core:60113] [Bug #9454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4f63c763ad
commit
60e85501f2
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
Mon Jan 27 21:53:45 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* thread_pthread.c: get current main thread stack size, which may
|
||||||
|
be expanded than allocated size at initialization, by rlimit().
|
||||||
|
[ruby-core:60113] [Bug #9454]
|
||||||
|
|
||||||
|
Mon Jan 27 21:52:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* thread_pthread.c: get current main thread stack size, which may
|
||||||
|
be expanded than allocated size at initialization, by rlimit().
|
||||||
|
[ruby-core:60113] [Bug #9454]
|
||||||
|
|
||||||
Sat Jan 25 22:17:02 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
Sat Jan 25 22:17:02 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
* README.ja.md, README.md: update the controller address of
|
* README.ja.md, README.md: update the controller address of
|
||||||
|
@ -488,6 +488,16 @@ end.join
|
|||||||
rescue SystemStackError
|
rescue SystemStackError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_machine_stackoverflow_by_define_method
|
||||||
|
bug9454 = '[ruby-core:60113] [Bug #9454]'
|
||||||
|
assert_separately([], <<-SRC)
|
||||||
|
assert_raise(SystemStackError, #{bug9454.dump}) {
|
||||||
|
define_method(:foo) {self.foo}
|
||||||
|
self.foo
|
||||||
|
}
|
||||||
|
SRC
|
||||||
|
end
|
||||||
|
|
||||||
def test_cause
|
def test_cause
|
||||||
msg = "[Feature #8257]"
|
msg = "[Feature #8257]"
|
||||||
cause = nil
|
cause = nil
|
||||||
|
@ -1562,6 +1562,14 @@ ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr)
|
|||||||
|
|
||||||
if (th) {
|
if (th) {
|
||||||
size = th->machine_stack_maxsize;
|
size = th->machine_stack_maxsize;
|
||||||
|
#if defined(HAVE_GETRLIMIT) && MAINSTACKADDR_AVAILABLE
|
||||||
|
if (pthread_equal(th->thread_id, native_main_thread.id)) {
|
||||||
|
struct rlimit rlim;
|
||||||
|
if (getrlimit(RLIMIT_STACK, &rlim) == 0 && rlim.rlim_cur > size) {
|
||||||
|
size = rlim.rlim_cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
base = (char *)th->machine_stack_start - STACK_DIR_UPPER(0, size);
|
base = (char *)th->machine_stack_start - STACK_DIR_UPPER(0, size);
|
||||||
}
|
}
|
||||||
#ifdef STACKADDR_AVAILABLE
|
#ifdef STACKADDR_AVAILABLE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user