2019/9/3 C language memory management

Why study: development of embedded memory resources are very limited
Common mistakes:
1, the memory application is not successful, the use of proceeds
2, memory application is successful, but not initialized (caused by memory errors)
3, memory initialization is successful, but cross-border access (memory corruption)
4, forget the release of memory or releasing a portion (a memory leak)
 
C language need to manually manage: malloc (), free (), new ()
 
C language Memory Category:
1, the stack area (stack): The system automatically assigns
2, the heap (heap) zone: a programmer assigned manually release
3, global area (static area): All global variables, static variables (static)
4, constant zones: constant string of daily use
5, the code segment: executing code stored
6, the data segment: .data section: static memory allocation: initialized global variables (and non-zero)
          .bss group: uninitialized global variables (or initialized to 0)

Guess you like

Origin www.cnblogs.com/epll/p/11450657.html