malloc without free, what happens?
It's per-process. Once your process exits, the allocated memory is returned to the OS for use by other processes (new or existing).
To answer your edited question, there's only a finite amount of memory in your machine. So if you have a memory leak, then the major problem is that the memory isn't available for other processes to use. A secondary, but not negligible, effect is that your process image grows, you'll swap to disc and performance will be hit. Finally your program will exhaust all the memory in the system and fail, since it's unable to allocate any memory for itself.
It's arguable that for a small process with a short lifetime, memory leaks are tolerable, since the leaked memory will be small in quantity and short-lived.
Take a look at this resource, for possibly more info than you'll ever need. What we're discussing here is dynamic or heap allocation.
最新文章
- EasyUI创建异步树形菜单和动态添加标签页tab
- blade and soul zone overview
- hdu acm-1047 Integer Inquiry(大数相加)
- Windows 10 开始菜单修改程序
- .Net魔法堂:开启IIS的WebGarden、WebFarm和StateServer之旅
- Mac系统如何编辑hosts文件
- JQuery发送Ajax请求出现 500 Internal Server Error
- servlet 配置
- C++将username部分用*取代
- android 动态改变屏幕方向
- Objective-C ,ios,iphone开发基础:多个视图(view)之间的切换2,使用导航栏控制,以及视图之间传值。
- CSS定义字体间距 字体行与行间距
- 剑指Offer:二进制中1的个数
- Android -- 官方下拉刷新SwipeRefreshLayout
- hadoop yarn
- 2964:日历问题-poj
- TensorFlow占位符操作:tf.placeholder_with_default
- 楚乔传 Princess Agents
- Luogu P3388 【模板】割点(割顶)
- HDU 1251 统计难题(字典树 裸题 链表做法)