+ 1

What if i allocate my pc's full memory into a heap in c ?

If i use the entire memory of my pc in a c program ,i.e. lock down 2GB of memory in the heap segment using malloc().what will happen if I. compile the c program.

27th Jun 2017, 2:46 PM
suryapoojary
suryapoojary - avatar
5 Respuestas
+ 9
Interesting ... try it and tell us 😂😂
27th Jun 2017, 2:48 PM
Sun
Sun - avatar
+ 2
@Sun :D..:D
27th Jun 2017, 2:49 PM
suryapoojary
suryapoojary - avatar
+ 2
Depends on the OS. Windows will simply return a null pointer once you reach 2gb
27th Jun 2017, 4:32 PM
aklex
aklex - avatar
+ 1
Absolutely, especially if your program is compiled as 64 bit
27th Jun 2017, 5:09 PM
aklex
aklex - avatar
0
@alex..can I crash an OS using heap and c?
27th Jun 2017, 4:35 PM
suryapoojary
suryapoojary - avatar