|
Home > Archive > Unix Programming > April 2007 > excess allocation in heap segment of a process
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
excess allocation in heap segment of a process
|
|
| sam_cit@yahoo.co.in 2007-04-25, 7:19 am |
| Hi Everyone,
We all know that when the stack segment overflows, we get a error
saying stack overflow and the program terminates. A main() calling
itself recursivley results in this,
What happens when the heap segment overflows? when we keep on
allocating dynamic memory in a loop...
Thanks in advance!!!
| |
| Logan Shaw 2007-04-26, 1:18 am |
| sam_cit@yahoo.co.in wrote:
> We all know that when the stack segment overflows, we get a error
> saying stack overflow and the program terminates. A main() calling
> itself recursivley results in this,
>
> What happens when the heap segment overflows? when we keep on
> allocating dynamic memory in a loop...
Why would you keep on trying to allocate memory when you are
checking the return value from malloc() (or whatever) and it is
telling you there is no more memory left to allocate?
At any rate, I suppose what would happen is that you would end
up wasting a lot of CPU time.
- Logan
| |
| Bin Chen 2007-04-26, 1:18 am |
| On Apr 25, 6:27 pm, sam_...@yahoo.co.in wrote:
> Hi Everyone,
>
> We all know that when the stack segment overflows, we get a error
> saying stack overflow and the program terminates. A main() calling
> itself recursivley results in this,
>
> What happens when the heap segment overflows? when we keep on
> allocating dynamic memory in a loop...
>
> Thanks in advance!!!
I think the correct behavior is malloc() returns NULL.
|
|
|
|
|