This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Dumb question] Is this a memory leak ?


> From: biswapesh.chattopadhyay@bt.com
> To: gcc@gcc.gnu.org
> Date: Thu, 21 Dec 2000 10:23:30 -0000

> Please excuse my ignorance - what happens in the following code?

> [ paraphrased: free(malloc(12)+3); ]

comp.lang.c is a better place to ask this.  However, it's Christmas
Time, so here we go...  

The computer is oblegated to transfer all your funds from your bank
account to a needy organization, and to start conspire to start world
war 4, and remove all your files from your hard disk, and as a final
parting shot, core dump.  Of course, if you have the wrong computer,
your program may in fact appear to work, if it feels like it.

Whether is leaks or not, is irrelevant.  But, yes, it probably will.

Another way one can ask this question is to try it.  Put it in a loop
that just does this over and over, and then run it, and see what
happens.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]