Resolved Memory management of structs


most discussion memory management of objective-c based on classes derived nsobject. how memory management of struct? similar standard c++ memory management (using new , delete)? example struct shown follows:
code:
typedef struct  {      int startposition;      int endposition;      int velocity;  } carinfo;
 

when creating it:

code:
struct carinfo *car = malloc(sizeof(struct carinfo));
when freeing it:

code:
free(car);  car = null;
or can use stack based struct:

code:
struct carinfo car;
and have no need use manual memory management (although when goes out of scope object automatically destroyed).
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Has to be the funniest headline ive ever seen

Man Brings Goat to Apple Store and has Pizza Delivered

Elusive Ninja: The Shadowy Thief - Can you survive the fast-paced ninja chaos?