Backround work by compiler/os to alloc memory

Discussion in 'C' started by rahulonly4u, Sep 15, 2010.

  1. rahulonly4u

    rahulonly4u New Member

    Joined:
    Sep 6, 2010
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    software developer
    Location:
    india
    DearS

    I want to know what background work is done by compiler/OS when i dynamically create an object .
    my concern about what data structure it use to create the objects and allocate memory and when those data structures destroy can i explicitly destroy those data structures


    for example
    when i create a sub class object compiler create a virtual table if super class have a virtual function


    Thanks and Regards
    Rahul
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    You only need to concern yourself with the object itself. Every new X must be matched with a delete X. If the compiler adds extra code to allocate additional structures when you call new X, it will also add extra code to deallocate those structures when you call delete X. You cannot explicitly deallocate those extra structures yourself.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice