Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. char* ptr = nullptr;
  6. std::size_t byte_counter = 0;
  7. std::cout << "Starting memory allocation..." << std::endl;
  8. do {
  9. ptr = new char;
  10. ++byte_counter;
  11. } while(ptr); //never fails on linux because of memory overcommit
  12. std::cout << "Allocated " << byte_counter << " bytes..." << std::endl;
  13.  
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement