1 // Copyright 2016 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include <new> 6 7 // 512MB structure. 8 struct BigStruct { 9 int y[128 * 1024 * 1024]; 10 }; 11 cpp_out_of_mem()12extern "C" int cpp_out_of_mem() { 13 int rv = 0; 14 for (int ix = 0; ix < 1000; ++ix) { 15 auto big = new BigStruct; 16 rv += (&big->y[0] > &rv) ? 0 : 1; 17 } 18 return rv; 19 } 20