[algogeeks] Re: Free memory
more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Free memory
Global too goes to stack,the data stack.Static variables also go to the stack.That's how they retain their values during function calls. On Sun, Jul 17, 2011 at 3:02 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Free memory
local stack is different and global is different ? and runtime memory is going to memory heap that i know. Saurabh : above snippet does not give runtime error. On Sun, Jul 17, 2011 at 3:04 PM, saurabh singh saurab...@gmail.com wrote: Global too goes to stack,the data stack.Static variables also go to the stack.That's how they retain their values during function calls. On Sun, Jul 17, 2011 at 3:02 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Free memory
Machine/OS? I am pretty sure it will give. On Sun, Jul 17, 2011 at 3:09 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: local stack is different and global is different ? and runtime memory is going to memory heap that i know. Saurabh : above snippet does not give runtime error. On Sun, Jul 17, 2011 at 3:04 PM, saurabh singh saurab...@gmail.comwrote: Global too goes to stack,the data stack.Static variables also go to the stack.That's how they retain their values during function calls. On Sun, Jul 17, 2011 at 3:02 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Free memory
yups it will give segmentation fault u should only free the memory allocated dynamically(heap) On Sun, Jul 17, 2011 at 3:59 PM, saurabh singh saurab...@gmail.com wrote: Machine/OS? I am pretty sure it will give. On Sun, Jul 17, 2011 at 3:09 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: local stack is different and global is different ? and runtime memory is going to memory heap that i know. Saurabh : above snippet does not give runtime error. On Sun, Jul 17, 2011 at 3:04 PM, saurabh singh saurab...@gmail.comwrote: Global too goes to stack,the data stack.Static variables also go to the stack.That's how they retain their values during function calls. On Sun, Jul 17, 2011 at 3:02 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- best wishes!! Vaibhav Shukla DU-MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Free memory
http://www.ideone.com/LmFES On Sun, Jul 17, 2011 at 3:59 PM, saurabh singh saurab...@gmail.com wrote: Machine/OS? I am pretty sure it will give. On Sun, Jul 17, 2011 at 3:09 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: local stack is different and global is different ? and runtime memory is going to memory heap that i know. Saurabh : above snippet does not give runtime error. On Sun, Jul 17, 2011 at 3:04 PM, saurabh singh saurab...@gmail.comwrote: Global too goes to stack,the data stack.Static variables also go to the stack.That's how they retain their values during function calls. On Sun, Jul 17, 2011 at 3:02 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Free memory
holy sh*t . I need to switch from MinGw was using codeblocks. Thanks :) On Sun, Jul 17, 2011 at 4:02 PM, saurabh singh saurab...@gmail.com wrote: http://www.ideone.com/LmFES On Sun, Jul 17, 2011 at 3:59 PM, saurabh singh saurab...@gmail.comwrote: Machine/OS? I am pretty sure it will give. On Sun, Jul 17, 2011 at 3:09 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: local stack is different and global is different ? and runtime memory is going to memory heap that i know. Saurabh : above snippet does not give runtime error. On Sun, Jul 17, 2011 at 3:04 PM, saurabh singh saurab...@gmail.comwrote: Global too goes to stack,the data stack.Static variables also go to the stack.That's how they retain their values during function calls. On Sun, Jul 17, 2011 at 3:02 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Free memory
apart from stack and heap and text/code segment, there's another segment called data segment for holding global and static vars. Data segment itself has two variants for initialised and uninitialised data(BSS). surender On Sun, Jul 17, 2011 at 5:09 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: holy sh*t . I need to switch from MinGw was using codeblocks. Thanks :) On Sun, Jul 17, 2011 at 4:02 PM, saurabh singh saurab...@gmail.comwrote: http://www.ideone.com/LmFES On Sun, Jul 17, 2011 at 3:59 PM, saurabh singh saurab...@gmail.comwrote: Machine/OS? I am pretty sure it will give. On Sun, Jul 17, 2011 at 3:09 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: local stack is different and global is different ? and runtime memory is going to memory heap that i know. Saurabh : above snippet does not give runtime error. On Sun, Jul 17, 2011 at 3:04 PM, saurabh singh saurab...@gmail.comwrote: Global too goes to stack,the data stack.Static variables also go to the stack.That's how they retain their values during function calls. On Sun, Jul 17, 2011 at 3:02 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: more generally what is the memory structure of local , global and runtime allocated variable . I guess , runtime allocation is done from memory heap , local goes in to a stack . What about global ? On Sun, Jul 17, 2011 at 2:57 PM, Ankur Khurana ankur.kkhur...@gmail.com wrote: Can we do this ? int i=12; free(i); Regards, Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science , 4th year Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.