Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- char* ptr = nullptr;
- std::size_t byte_counter = 0;
- std::cout << "Starting memory allocation..." << std::endl;
- do {
- ptr = new char;
- ++byte_counter;
- } while(ptr); //never fails on linux because of memory overcommit
- std::cout << "Allocated " << byte_counter << " bytes..." << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement