PDA

View Full Version : Memory management of structs




chen8002004
May 24, 2011, 11:31 PM
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;



psonice
May 25, 2011, 03:30 AM
It's straight C memory management, if you malloc() it, you need to free() it.