fork(8) download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. size_t Count = 1024*1024*1024; // 1 Gb
  7. Count *= 5; // 5 Gb
  8.  
  9. std::cout << Count << std::endl;
  10.  
  11. char *array = new char[Count];
  12. memset(array, 0, Count);
  13.  
  14. int32_t index = 0;
  15. for (size_t i = 0; i != Count; i++)
  16. array[index++] = char(i) | 1;
  17.  
  18. if (array[Count - 1] == 0)
  19. std::cout << "The last array element contains 0.n";
  20.  
  21. delete [] array;
  22. return 0;
  23. }
Success #stdin #stdout 4.06s 15232KB
stdin
Standard input is empty
stdout
5368709120