各位大虾:如果再一个函数里面申请内存{GlobalAlloc();lp = GlobaLock().......
,return lp },
我想问一下,我把内存锁定的指针lp给返回出来了,那么我怎么在这个函数外面进行释放我在函数里面申请的内存呢?????
,return lp },
我想问一下,我把内存锁定的指针lp给返回出来了,那么我怎么在这个函数外面进行释放我在函数里面申请的内存呢?????
解决方案 »
- opencv视频显示很卡,很慢,内存泄露
- 请教 C,C++ 与 vs2010 C++ 区别?2.VC++程序需要装.netframework到客户机吗?
- 高分求解,请问mif文件格式以及、读写方法?
- 怎么设置vc++的文本编辑内码环境?
- 哪位大侠能提供一下OPC client端的VC源代码亚 不要是demo版的
- 很急的小问题,在线等待,立即给100分
- 从系统中提取的图标始终有白色背景,怎么才能去掉啊?
- 有没有一些动态创建控件的源代码
- 如何实现象记事本的自动换行功能。
- 初学问题.ctrl+F5后,编译有3个error怎么能找到这3个错误的地方?
- 串口编程MscComm中经常返回"帧错误"是什么原因?
- 我要作一个项目,不知道是否该用完成端口来实现,请大伙帮我看看!
HGLOBAL hMem // handle to global memory object
);
HGLOBAL GlobalFree(
HGLOBAL hMem
);Parameters
hMem
[in] Handle to the global memory object. This handle is returned by either the GlobalAlloc or GlobalReAlloc function.
Return Values
If the function succeeds, the return value is NULL.If the function fails, the return value is equal to a handle to the global memory object. To get extended error information, call GetLastError.Res
If the process examines or modifies the memory after it has been freed, heap corruption may occur or an access violation exception (EXCEPTION_ACCESS_VIOLATION) may be generated.If the hgblMem parameter is NULL, GlobalFree fails and the system generates an access violation exception.The GlobalFree function will free a locked memory object. A locked memory object has a lock count greater than zero. The GlobalLock function locks a global memory object and increments the lock count by one. The GlobalUnlock function unlocks it and decrements the lock count by one. To get the lock count of a global memory object, use the GlobalFlags function.If an application is running under a debug version of the system, GlobalFree will issue a message that tells you that a locked object is being freed. If you are debugging the application, GlobalFree will enter a breakpoint just before freeing a locked object. This allows you to verify the intended behavior, then continue execution.
因为globalFree的参数是句柄,我的问题,也可以这样说,怎么把我的那块内存的指针,转换为
那块内存的句柄,这样我就能用GlobalFree来释放了!!求救各位大虾!!!
肯定是要的,谢谢!,可是我想返回指针,各位大虾有没有什么好方法!!?????