Thread: Not doing free()

  1. #1
    Registered User
    Join Date
    Apr 2015
    Posts
    567

    Not doing free()

    Hi ;
    In abbreviation, the concept is deleting third entry of linked lists;
    if I have a linked lists (it's one direction) and lets say I have jumped from the second entry of linked lists to the fourth entry ; meaning with this I have updated the pointer of Node * next of second entry to point on the fourth entry, what happen to third entry, I'm not having access to it at all, this means implicitly I have deleted it, my question will PC free it by itself? if not doing free to it as, will the data of entry three be saved forever in the memory?! it's not logically.


    thanks !

  2. #2
    Registered User
    Join Date
    Apr 2015
    Posts
    567
    I know it's not good idea for deleting entry in that approach, just wanted to figure out what's going on in that case (for those whom think it's stupid question, Yup may I'm more than stupid of what you guess, but I'm here to learn)
    Last edited by RyanC; 12-13-2018 at 07:38 AM.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,130
    > my question will PC free it by itself?
    No, you have to do this yourself.

    > if not doing free to it as, will the data of entry three be saved forever in the memory?
    Well it will remain in memory until the program itself exits (or is killed by the OS).
    Or if you have no OS, it will stay in memory until your machine does a hard reboot - perhaps because you ran out of memory.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. license-free lock-free data structure library updated
    By Toby Douglass in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 12-30-2015, 05:50 PM
  2. Replies: 16
    Last Post: 12-28-2012, 04:07 PM
  3. new license-free lock-free data structure library published
    By Toby Douglass in forum Projects and Job Recruitment
    Replies: 19
    Last Post: 12-22-2009, 02:33 AM
  4. Malloc - Free giving double free or corruption error
    By andrew.bolster in forum C Programming
    Replies: 2
    Last Post: 11-02-2007, 06:22 AM
  5. What's cooler than free boobs? 5 free assembly books from AMD.
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 47
    Last Post: 02-13-2003, 08:22 PM

Tags for this Thread