Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <new>
- int main(void)
- {
- std::cout << "START LOOP FOR 10 TIMES" << std::endl;
- for (int s = 0; s < 10; s++)
- {
- try
- {
- int* memoryLeak = new int[100000000];
- }
- catch (std::bad_alloc &eception)
- {
- std::cout << "catch loop error (" << (s+1) << "/10): " << eception.what() << std::endl;
- }
- }
- // Speicherbelegung
- // length int kb mb loop result
- // (((100000000 * 4Bytes) * 1024) * 1024) * 10 = 3810 Mb
- std::cout << "END 10 TIMES" << std::flush;
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement