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

Mail will not Quit when shutting down

MacBook Air 2011 Reviews

What's the max amount of RAM an iMac can have to run BootCamp & Parallels Windows 7?