System Services -> Memory Management -> About Memory Management
Memory Performance Information
Comparing Memory Allocation Methods
==========================================
The following is a brief comparison of the various memory allocation methods:
CoTaskMemAlloc
GlobalAlloc
HeapAlloc
LocalAlloc
malloc
new
VirtualAlloc
Although the GlobalAlloc, LocalAlloc, and HeapAlloc functions ultimately allocate memory from the same heap, each provides a slightly different set of functionality. For example, HeapAlloc can be instructed to raise an exception if memory could not be allocated, a capability not available with LocalAlloc. LocalAlloc supports allocation of handles which permit the underlying memory to be moved by a reallocation without changing the handle value, a capability not available with HeapAlloc.
Starting with 32-bit Windows, GlobalAlloc and LocalAlloc are implemented as wrapper functions that call HeapAlloc using a handle to the process's default heap. Therefore, GlobalAlloc and LocalAlloc have greater overhead than HeapAlloc.
Because the different heap allocators provide distinctive functionality by using different mechanisms, you must free memory with the correct function. For example, memory allocated with HeapAlloc must be freed with HeapFree and not LocalFree or GlobalFree. Memory allocated with GlobalAlloc or LocalAlloc must be queried, validated, and released with the corresponding global or local function.
The VirtualAlloc function allows you to specify additional options for memory allocation. However, its allocations use a page granularity, so using VirtualAlloc can result in higher memory usage.
The malloc function has the disadvantage of being run-time dependent. The new operator has the disadvantage of being compiler dependent and language dependent.
The CoTaskMemAlloc function has the advantage of working well in either C, C++, or Visual Basic. It is also the only way to share memory in a COM-based application, since MIDL uses CoTaskMemAlloc and CoTaskMemFree to marshal memory.
特别提示的是
poco工程中,很多用 LocalAlloc
System Services -> Memory Management -> About Memory Management的更多相关文章
- 解决Mac OS下安装MyEclipse报错:Your system does not have sufficient memory to support MyEclipse
最近想尝尝鲜,FQ去www.myeclipseide.com上下载了最新版的MyEclipse 15CI版,安装的时候,报告如下错误(MyEclipse 14也会出现这个问题): Your syste ...
- iOS System Services
System Services is a singleton class to gather all available information about a device. Over 75 met ...
- RH133读书 笔记(4) - Lab 4 System Services
Lab 4 System Services Goal: Develop skills using system administration tools and setting up and admi ...
- Java 堆内存与栈内存异同(Java Heap Memory vs Stack Memory Difference)
--reference Java Heap Memory vs Stack Memory Difference 在数据结构中,堆和栈可以说是两种最基础的数据结构,而Java中的栈内存空间和堆内存空间有 ...
- Arcgis map export or print Error: Cannot map metafile into memory. Not enough memory
Arcgis map export or print Error: Cannot map metafile into memory. Not enough memory Link: https:/ ...
- 每个内存大小:sudo dmidecode -t memory |grep -A16 "Memory Device$" |grep "Size:"
CPU: 型号:grep "model name" /proc/cpuinfo |awk -F ':' '{print $NF}' 数量:lscpu |grep "CPU ...
- MEMORY Storage Engine MEMORY Tables TEMPORARY TABLE max_heap_table_size
http://dev.mysql.com/doc/refman/5.7/en/create-table.html You can use the TEMPORARY keyword when crea ...
- Diagnosing out of memory errors and memory leaks 内存泄露实例 C Java JavaScript 内存泄露
小结: 1. 数据库连接池. JDBC语句和结果对象必须显式地关闭. 2. 电梯到目标楼层后地址是否被释放 When a button is pressed: Get some memory, whi ...
- #define barrier() __asm__ __volatile__("": : :"memory") 中的memory是gcc的东西
gcc内嵌汇编简介 在内嵌汇编中,可以将C语言表达式指定为汇编指令的操作数,而且不用去管如何将C语言表达式的值读入哪个寄存器,以及如何将计算结果写回C 变量,你只要告诉程序中C语言表达式与汇编指令操作 ...
- service citrix xcenserver health check service (xenserver healthcheck) failed to start verfy that you have sufficient privileges to srart system services
citrix XcenServer版本:7.2 citrix Xcencenter版本:7.2 安装citrix Xcencenter的时候报错: service citrix xcenserver ...
随机推荐
- DIY Ruby CPU 分析——Part I
[编者按]原文作者 Emil Soman,Rubyist,除此之外竟然同时也是艺术家,吉他手,Garden City RubyConf 组织者.本文是DIY Ruby CPU Profiling 的第 ...
- 【C++之STL】理解容器(ing)
“容器可容纳一些数据的模板类” “容器是包容其他对象的对象” 两种类型:顺序容器.关联容器 顺序容器 关联容器 访问成员 顺序访问和随机访问 经过优化关键键值访问 ...
- Mutex vs Semaphore
What are the differences between Mutex vs Semaphore? When to use mutex and when to use semaphore? Co ...
- UVA 11424 GCD - Extreme (I) (欧拉函数+筛法)
题目:给出n,求gcd(1,2)+gcd(1,3)+gcd(2,3)+gcd(1,4)+gcd(2,4)+gcd(3,4)+...+gcd(1,n)+gcd(2,n)+...+gcd(n-1,n) 此 ...
- ubuntu下安装spark1.4.0
构建在hadoop2.6.0之上的 1.在官网下载spark-1.4.0-bin-hadoop2.6.tgz 2.解压到你想要放的文件夹里,tar zxvf spark-1.4.0-bin-hadoo ...
- php集成开发环境的安装以及Zend Studio开发工具的安装
一.集成开发环境: wampserver 下载地址: 官网: http://www.wampserver.com/ 直接下载 http://sourceforge.net/projects/wamps ...
- MySQL 卸载 --Mac
pkill mysql sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems ...
- 李洪强iOS开发之【零基础学习iOS开发】【02-C语言】02-第一个C语言程序
前言 前面已经唠叨了这么多理论知识,从这讲开始,就要通过接触代码来学习C语言的语法.学习任何一门语言,首先要掌握的肯定是语法.学习C语言语法的目的:就是能够利用C语言编写程序,然后运行程序跟硬件(计算 ...
- lintcode:数字三角形
题目: 数字三角形 给定一个数字三角形,找到从顶部到底部的最小路径和.每一步可以移动到下面一行的相邻数字上. 样例 比如,给出下列数字三角形: [ [2], [3,4], [6 ...
- hdu 4465 Candy
题解: 由题意得 需要运用: C(m,n)=exp(logC(m,n)) f[]=; ; i<=; i++) f[i]=f[i-]+log(i*1.0); double logC(int m,i ...