Memory management of structs

Discussion in 'iOS Apps' started by chen8002004, May 24, 2011.

  1. macrumors newbie

    Joined:
    May 22, 2011
    #1
    Most discussion about memory management of Objective-C is based on classes derived from NSObject. How about the memory management of a struct? Is it similar to standard C++ memory management (using new and delete)? An example struct is shown as follows:
    typedef struct
    {
    int startPosition;
    int endPosition;
    int Velocity;
    } carInfo;
     
  2. macrumors 6502a

    Joined:
    Jul 22, 2005
    #2
    It's straight C memory management, if you malloc() it, you need to free() it.
     

Share This Page