CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

CreateFileMapping之后,如何Release 这个Mapping , 并重新CreateFileMapping(大小不同)

楼主qli()2003-11-01 01:14:01 在 VC/MFC / 基础类 提问

CreateFileMapping之后,即使做了unMapViewOfFile   和CloseHandle,  
  好象这个Share   memory   还在,用OpenFileMapping   还可以打开来读.  
  如何Release   这个Mapping   ,   并重新CreateFileMapping(大小不同)?  
  问题点数:0、回复次数:3Top

1 楼saucer(思归)回复于 2003-11-01 04:08:40 得分 0

you   have   to   unmap   all   views,   close   all   handles,   from   the   documentation:  
   
  "...  
  To   fully   close   a   file   mapping   object,   an   application   must   unmap   all   mapped   views   of   the   file   mapping   object   by   calling   UnmapViewOfFile,   and   close   the   file   mapping   object   handle   by   calling   CloseHandle  
  ..."  
   
  also   see  
   
  "Necessity   of   Unmapping   All   Views   of   a   Mapped   File"  
  http://support.microsoft.com/default.aspx?kbid=125713  
   
  you   may   have   an   unmapped   file   from   previous   try,   consider   to   reboot   your   machine,   and   try   again  
  Top

2 楼qli()回复于 2003-11-01 05:58:42 得分 0

Thanks,    
  although   unmapped   all   views   and   closed   all   handles,   the   win2000   seams   still   hold   the   map   registration.   whatever   reboot   or   not   ,   the   next   time   it   is   able   to   open   and   read   again.    
  At   first   what   I   try   to   do   is   to   change   the   size.   it   was   successful   by   calling   CreateFileMapping   again.  
  Now   what   I   worry   about   is   that   it   seams   the   memory   won't   get   released.All   the   information   from   the   internet   doesn't   show   how   to   release   what   the   CreateFileMapping   did.   I   am   wondering   that   there   would   be   some   functions   to   do   that   which   we   don't   know.Top

3 楼saucer(思归)回复于 2003-11-01 06:10:37 得分 0

I   don't   have   C++   compiler   at   hand,   so   I   cannot   test   it   for   you,   but   see  
   
  http://scv.bu.edu/SCV/Archive/IBM/IBMdocs/c/compiler/tasks/tumemex2.htm  
   
  Top

相关问题

  • 大小
  • 数的大小
  • PBL的大小?
  • ram值大小
  • 控件大小
  • 文件大小
  • 文件大小
  • 大小写
  • 文件大小
  • 比大小

关键词

  • createfilemapping
  • unmapped
  • map
  • views
  • handles
  • closed
  • try
  • object

得分解答快速导航

  • 帖主:qli

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo