Object /pointer life time in C++

Discussion in 'C++' started by stefan12, Aug 4, 2012.

  1. stefan12

    stefan12 New Member

    Joined:
    Aug 4, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello all,

    I added some classes to ns-2 network simulator for my project. The classes communicate to each other by sending messages using tcp protocol. When I am running simulations some times objects are destroyed before simulation ends.

    I would appreciate if some one shares me about object life time in c++ and how Linux system handles applications that consume large memory and CPU time.

    I can post some part of the code if required.

    thanks,
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    Object lifetime is unlimited. Objects get freed when you free them and not before. C++ is not Java and there is no garbage collector.
     

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