Skip to content

Instantly share code, notes, and snippets.

@totem3
Created May 6, 2020 12:57
Show Gist options
  • Save totem3/1c1522f2935f4658f81bf29624c75c32 to your computer and use it in GitHub Desktop.
Save totem3/1c1522f2935f4658f81bf29624c75c32 to your computer and use it in GitHub Desktop.
windowsとlinuxでstack overflowするサイズの比較
#![allow(unused)]
use std::fs::File;
use std::io::{self, Read, Write};
const SIZE: usize = 8000;
fn main() {
let stack = std::env::var("RUST_MIN_STACK").unwrap_or("nothing".to_string());
println!("RUST_MIN_STACK: {}", stack);
println!("allocate size: {}MB", SIZE * 1024 / 1024 / 1024);
let x = [[0u8; 1024]; SIZE];
for i in x.iter() {
for j in i.iter() {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment