on-internet
← Community

Under what circumstances can malloc return NULL?

Stack Overflow ·

It has never happened to me, and I've programming for years now. Can someone give me an example of a non-trivial program in which malloc will actually not work? I'm not talking about memory exhaustion: I'm looking for the simple case when you are allocating just one memory block in a bound size given by the user, lets say an integer, causes malloc to fail.

Comments

Sign in or sign up to comment and upvote.

No comments yet.