Re: [rust-dev] Overflow when benchmarking

2014-11-28 Thread Matthieu Monrocq
Hello, To be clear: there is no such thing as stack/heap in C and C++, there are automatic variable and dynamically allocated variables, the former having their lifetime known statically and the latter not... Whether a particular compiler chooses to use the stack or heap for either is its free

Re: [rust-dev] Overflow when benchmarking

2014-11-27 Thread Diggory Hardy
Shouldn't the compiler automatically put large arrays on the heap? I thought this was a common thing to do beyond a certain memory size. On Thursday 27 November 2014 04:28:03 Steven Fackler wrote: The `nums` array is allocated on the stack and is 8 MB (assuming you're on a 64 bit platform).

Re: [rust-dev] Overflow when benchmarking

2014-11-27 Thread Steve Klabnik
Rust is not interested in putting anything automatically on the heap. :) ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] Overflow when benchmarking

2014-11-27 Thread Manish Goregaokar
C++/C has a lot of features which seem tantalizing at first; but end up being against the point of a systems language. Putting large arrays on the heap (not sure if C++ does this, but it sounds like something C++ would do) is one -- there are plenty of cases where you explicitly want stack-based

[rust-dev] Overflow when benchmarking

2014-11-26 Thread Ben Wilson
Hey folks, I've started writing some rust code lately and run into weird behavior when benchmarking. When running https://gist.github.com/benwilson512/56f84d4625f11feb #[bench] fn test_overflow(b: mut Bencher) { let nums = [0i, ..100]; b.iter(|| { let mut x = 0i; for i in

Re: [rust-dev] Overflow when benchmarking

2014-11-26 Thread Steven Fackler
The `nums` array is allocated on the stack and is 8 MB (assuming you're on a 64 bit platform). On Wed Nov 26 2014 at 8:23:08 PM Ben Wilson benwilson...@gmail.com wrote: Hey folks, I've started writing some rust code lately and run into weird behavior when benchmarking. When running

Re: [rust-dev] Overflow when benchmarking

2014-11-26 Thread Ben Wilson
Doh, of course. Thanks, it's been a while since I've written low level stuff. On Wed, Nov 26, 2014 at 10:28 PM, Steven Fackler sfack...@gmail.com wrote: The `nums` array is allocated on the stack and is 8 MB (assuming you're on a 64 bit platform). On Wed Nov 26 2014 at 8:23:08 PM Ben Wilson