diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-13 16:15:48 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-13 16:15:48 +0000 |
| commit | 7a224e9fa299fcefc5cacadd77b1fee95e40894d (patch) | |
| tree | c2e0fb331ef430a5e862f82df454ec2eae261288 | |
| parent | 0c2dd1f78f45cc67e50caf0aac5c95aed7e0dccc (diff) | |
| download | ruby-7a224e9fa299fcefc5cacadd77b1fee95e40894d.tar.gz ruby-7a224e9fa299fcefc5cacadd77b1fee95e40894d.tar.xz ruby-7a224e9fa299fcefc5cacadd77b1fee95e40894d.zip | |
* gc.c (ruby_init_stack): decrease "stack level too deep" in Windows.
[ruby-dev:29569]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | gc.c | 15 |
2 files changed, 19 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Thu Sep 14 01:13:56 2006 NAKAMURA Usaku <usa@ruby-lang.org> + + * gc.c (ruby_init_stack): decrease "stack level too deep" in Windows. + [ruby-dev:29569] + Thu Sep 14 01:02:25 2006 Tanaka Akira <akr@fsij.org> * ext/digest/lib/digest.rb: new file. @@ -470,7 +470,7 @@ static unsigned int STACK_LEVEL_MAX = 65535; unsigned int _stacksize = 262144; # define STACK_LEVEL_MAX (_stacksize - 4096) # undef HAVE_GETRLIMIT -#elif defined(HAVE_GETRLIMIT) +#elif defined(HAVE_GETRLIMIT) || defined(_WIN32) static unsigned int STACK_LEVEL_MAX = 655300; #else # define STACK_LEVEL_MAX 655300 @@ -1540,6 +1540,19 @@ void ruby_init_stack(VALUE *addr STACK_LEVEL_MAX = (rlim.rlim_cur - space) / sizeof(VALUE); } } +#elif defined _WIN32 + { + MEMORY_BASIC_INFORMATION mi; + DWORD size; + DWORD space; + + if (VirtualQuery(&mi, &mi, sizeof(mi))) { + size = (char *)mi.BaseAddress - (char *)mi.AllocationBase; + space = size / 5; + if (space > 1024*1024) space = 1024*1024; + STACK_LEVEL_MAX = (size - space) / sizeof(VALUE); + } + } #endif } |
