在 C++ 程序中,最普遍使用的资源是 dynamically allocated memory(动态分配的内存)(如果你分配了内存却从不释放,就会导致 memory leak(内存泄漏)的后果),但是内存仅仅是很多你必须管理的资源中的一种。
基于16个网页-相关网页
始终正确处理返回动态分配的内存引用的函数返回值。
Always properly handle return values of functions returning references of dynamically allocated memory.
Packratting:由于长时间不及时释放动态分配的内存而消耗了过量的内存。
Packratting: Consuming excessive memory by keeping dynamically allocated objects alive for longer than they are needed.
数据区域同时包括静态分配的内存(比如全局和静态数据)和动态分配的内存(通常称为 堆)。
The data region includes both statically allocated memory (such as global and static data) and dynamically allocated memory (often called the heap).
Why not write the program in a way where you figure out dynamically when the program is run how much memory you need rather than hard coding in two with or within that constant.
为什么不写一个可以动态的方式写那个程序,程序可以动态分配内存,而不是用常量硬编码两个值。
应用推荐