+ 2
Why no exception
Hi I am doing so many allocation in for loop, but it is still not throwing exception. I just need to ovserve bad_alloc throw and was expecting this code to crash due to non handled exception. When does sololearn not allocate heap memory ? https://code.sololearn.com/cFpAO3jJGD8V/?ref=app
2 Antworten
+ 3
Allocations are fine.
Instead try:
p = new int[10000000000]; //for exception.
+ 2
Thanks... basically this platform handles int_max allocation... just tried with your value and it worked. Modified code with long_max/10 as long_max was giving issue.
Thank you so much