- Hands-On System Programming with C++
- Dr. Rian Quinn
- 242字
- 2021-07-02 14:42:28
Memory allocation
Memory is another resource that an application must request using a system call. Most applications are given global and stack memory resources when the application is first executed, along with a small heap of memory that the application can use when calls to functions such as malloc() and free() are made.
If the application only uses the memory that it is initially given in this heap, no extra memory needs to be requested by the application. If, however, heap memory runs out, the application's malloc() or free() engine will have to ask the operating system (via a system call) for more memory.
To do this, the operating system will extend the end of the application by adding more physical memory to the application. The malloc() or free() engine is then able to make use of this additional memory, until more is needed.
On systems with limited RAM, when a request for additional memory is made, the operating system has to take memory from other applications that aren't currently executing. It does this by swapping these applications to disk, an operation that is expensive to perform.
For this reason, on resource-constrained systems, calls to malloc() or free() should not be made in time-critical code, as the time it takes to execute these functions can vary greatly.
We will go into further detail on memory management in Chapter 7, A Comprehensive Look at Memory Management.
- 公有云容器化指南:騰訊云TKE實戰與應用
- SQL Server入門經典
- 使用GitOps實現Kubernetes的持續部署:模式、流程及工具
- 企業大數據系統構建實戰:技術、架構、實施與應用
- Mockito Cookbook
- 大數據營銷:如何讓營銷更具吸引力
- 數據庫原理與應用(Oracle版)
- 數亦有道:Python數據科學指南
- “互聯網+”時代立體化計算機組
- 大數據技術入門
- INSTANT Apple iBooks How-to
- 聯動Oracle:設計思想、架構實現與AWR報告
- 數據庫與數據處理:Access 2010實現
- SIEMENS數控技術應用工程師:SINUMERIK 840D-810D數控系統功能應用與維修調整教程
- 信息融合中估計算法的性能評估