do some operating systems kill a thread as soon as it detects a memory leak? The operating system i'm talking about is Windows XP, in this case. I had a small subroutine, that used to initialize a new variable [dynamic memory allocation], write some value to it and return the pointer [let's call it 'ptrInside']. When the function was called, another pointer was collecting it [let's call it 'ptrOutside']. What happened is, when I call the subroutine once, it's fine. Because although the pointer declared in the function is killed, there is some variable i.e. 'ptrOutside' which was referring to the allocated space [let's call it 'gothSpace']. But when i called it the second time, 'ptrOutside' was now pointing to some other allocated space [let's call it 'blondeSpace']. So, now that the 'blondeSpace' was getting all the attention, and 'gothSpace' was lonely inside the memory, with no pointer referring to it. What happened is that, Windows killed the process abruptly, with no reason whatsoever, being the conformist it is. So, my question is that.. do some operating systems kill processes immediately when they detect that there is a goth in the heap about which nobody in the stack cares about?