Ask your own question, for FREE!
Computer Science 11 Online
OpenStudy (anonymous):

What happens to your computer while a program like this is executing? \[#include #include int main(void) { while (malloc(sizeof(char))); return 0; }\]

OpenStudy (anonymous):

http://ideone.com/2py44

OpenStudy (mathmate):

Since there is no garbage collection (like in Java), it will eventually run out of memory (heap space?)

OpenStudy (anonymous):

On my computer it just keeps running unless I increase the size of the chunks in malloc like sizeof(char) << 20 to allocate megabyte chunks

OpenStudy (anonymous):

how many megabytes can your computer allocate?

OpenStudy (mathmate):

What compiler do you use?

OpenStudy (mathmate):

I'll try it out before I can tell you!

OpenStudy (anonymous):

http://ideone.com/uQTWW

OpenStudy (anonymous):

I use MinGW

OpenStudy (mathmate):

I can allocate an int array of up to about 520000, using devC++, which is a cousin of MinGW.

OpenStudy (anonymous):

you already asked this question, havent you? :P

OpenStudy (farmdawgnation):

Ditto to Tomas, this looks almost exactly like a previous question you asked.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!