IOS memory partition


#Stack area

It is a continuous data structure expanded from high address to low address, which is used to store the values of local variables and function parameters

#Heap area

Programmers need to manage and release the data structure domain expanded by low address like high address and discontinuous memory area

#Global area

Global variables and static variables are stored together. Initialized global variables and initialized static variables are in one area, and uninitialized variables are in another adjacent area

#Constant area

Used to store constant strings

#Code area

Binary code for storing functions


##In IOS, obtaining memory is shared between applications, and the system is automatically responsible for obtaining memory allocation

##The system uses a linked list to maintain all allocated memory space (the system only records, not manages)

##After the variable is used, the memory needs to be released. In OC, judge whether the reference count is 0 to judge whether to reclaim the space

##When an app is started, the size of the code area, constant area and global area has been fixed. Therefore, we just want that the pointers of these areas will not have crashing errors. The heap area and stack area change from time to time (creation and destruction of the stack, pop-up of the stack). Therefore, when using a pointer to point to the memory of this area, be sure to pay attention to whether the memory has been recycled, otherwise it will crash and report wild pointer errors

Recommended Today

Resultmap result map

Expand an object to save the query results Create a dto package SRC main Java com mybatis dto Dto is a special JavaBean,JavaBean is a kind of Java class, which conforms to a certain writing specification. It is a specification of entity and information. JavaBean specification: (1) There must be 1 Public parameterless construct (2) […]