Windows Server 2008上的共享内存问题 [英] Shared memory issue on Windows Server 2008

查看:87
本文介绍了Windows Server 2008上的共享内存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我有一个在W2K3上工作正常但在W2K8上失败的代码。
我在WEB中找不到这一点。

这就是代码的作用:第一个进程启动,调用CreateFileMapping()和MapViewOfFile(),然后继续运行而不再触及共享内存。
第二个进程启动并调用相同的代码来映​​射共享内存,然后读取/写入此内存并退出。是的,它在退出时调用UnmapViewOfFile()和CloseHandle()。由于第一个进程持有句柄,因此内存不会释放。
然后第二个进程再次启动,读/写,退出等。

请注意,第二个过程可能会通过向其添加更多内容来扩展此共享内存。

第二个过程开始第二个过程时发生故障(ACCVIO)时间并尝试从映射的内存中读取。
同样,这在Windows Server 2003上运行正常!
如果您对此原因有任何疑问,请提供帮助。

我正在W2K3上的Visual Studio 2005 SP1上构建此代码。未安装适用于Windows Server 2008和.NET Framework 3.5 Windows的SDK。
可能是这种情况吗?

如果您希望我发布实际代码,我可以这样做,只需告诉我代码的哪一部分。
谢谢。
Hi everybody.

I have a code that works fine on W2K3 and fails on W2K8.
I couldn't find any mention of this in the WEB.

So here is what the code does:
1st process starts, calls CreateFileMapping() and MapViewOfFile(), and then stays running without touching that shared memory anymore.
2nd process starts and calls the very same piece of code to map the shared memory, then reads from/writes to this memory and exits. Yes, it does call UnmapViewOfFile() and CloseHandle() on exit.
Since the 1st process holds the handle, the memory does not get released.
Then the 2nd process starts again, reads/writes, exits, etc.

Note that the 2nd process might expand this shared memory by adding more contents to it.

The failure (ACCVIO) occurs when the 2nd process starts for the second time and tries to read from the mapped memory.
Again, this works fine on Windows server 2003!
If you have any clue of why this is happening, please help.

I'm building this code on Visual Studio 2005 SP1 on W2K3. SDK for Windows Server 2008 and .NET Framework 3.5 Windows is NOT installed.
Could this be the case ?

If you want me to post the actual code, I can do it, just tell me what part of the code.
Thank you.

推荐答案

你好,


我很期待对此有一些坚定的解决方案的一些研究。发布此回复是为了尽快回复您。

亲切的问候
深刻的夏尔马
Hi,


 I am looking forward for some research for some firm solution on this . Posting this reply to get back to you as sooner as possible.


Kind Regards
Deep Sharma


这篇关于Windows Server 2008上的共享内存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆