VS 2008如何处理几个核心 [英] How to deal with several cores VS 2008

查看:63
本文介绍了VS 2008如何处理几个核心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

自从有几天以来,我已经运行了多年的程序出现了内存不足"的异常. (可能来自某些更新...)

奇怪的是,它们仍然可以在Windows XP 32位(内存更少)上很好地工作.用于这些程序的两台计算机都是Windows 7 64位双核(2 GO RAM)和四核(6 GO RAM).因此,我真的怀疑我是否想念真正的记忆...

每次尝试处理少量图像时,当服务器达到50%CPU或25%CPU之后,我都会遇到内存不足"异常.这就是为什么我认为这是多核CPU的问题...

在此先感谢您的帮助,

Guillaume.

Hi everybody,

Since some days I have "out of memory" exception on my programs which had been working for years. (It might come from some updates...)

The weird part is they still works well on Windows XP 32 bits with much less memory. Both computers used for those programs are Windows 7 64 bits on dual core (2 GO RAM) and quad core (6 GO RAM). Thus I really doubt I miss real memory...

Each time I tried to work on few Images I have "out of memory" exception when it reaches 50% CPU or 25% CPU following the server. It''s why I think it''s a problem with multi core CPU...

Thanks in advance for any help,

Guillaume.

推荐答案

最初跳出我页面的是您正在使用图像.如果未正确执行此操作,则会使映像在内存中保持打开状态(如果变量执行错误,甚至会保留多个副本),这将导致内存问题.我构建了一个内存存在类似问题的应用程序.我将其追溯到一个地方,我在我的代码中未正确打开图像.那一个错误会使我的应用程序阻塞.为了找出这些内存问题,我建议您研究如何打开图像而不会泄漏内存,然后确保打开这些图像的每个位置都符合这些最佳做法.如果仍然找不到,请尝试使用内存探查器.这是一个很棒的免费演示程序:

http://www.red-gate.com/products/dotnet-development/ants -memory-profiler/ [ ^ ]

至于为什么它不能在64位上运行时为什么可以在32位上运行,我可以说这可能是因为应用程序的编译方式(32位vs. AnyCPU).我认为这不是真正的问题.我相信您的应用程序都会以两种方式泄漏内存,而64位计算机只是显示内存的那部分.如果不是,则该内存分析器将指出64位计算机的问题.

最后,您在这里将两个不同的部分混合在一起.内存和CPU不是一回事.具有多个内核不会帮助/损害内存问题.内存(RAM)用于项目的易失性存储(数据将像正在使用的图像一样很快被破坏,直到将其保存到磁盘上为止),而CPU(核心)用于计算(确定如何转换图像).更快的CPU可以减少内存问题,因为它可以更快地将某些内容从RAM中转出,因为它们的处理速度更快.但是,通常,这是两个单独的主题.就您而言,问题是内存(RAM),而不是处理器.
The thing that initially jumps off the page at me is that you are working with images. If you do not do this correctly, you will leave the image open in memory (or even multiple copies if you do your variables wrong) and this will cause memory issues. I built an app that had a similar issue with memory. I traced it down to one place where I improperly opened an image in my code. That one error would make my application choke. To trace down these memory issues, I would recommend that you look at how to open images without leaking memory and then ensure that every place you open those images conforms to these best practices. If you still can''t find something, try a memory profiler. Here is a great one that has a free demo:

http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/[^]

As to why this works on 32-bit when it doesn''t on 64-bit, I would say that it could be because of how the application is compiled (32-bit vs. AnyCPU). I don''t think this is the real problem. I believe your application is leaking memory either way and the 64-bit computers are just the ones showing it. If not, that memory profiler would point out the issue with the 64-bit computers.

Finally, you are mixing two different pieces together here. Memory and CPU are not the same thing. Having several cores will not help/harm a memory issue. Memory (RAM) is for volatile storage of items (data that will be destroyed soon like an image that you are working with until you save it to disk) while the CPU (cores) is for calculations (identifying how to transform the image). A faster CPU will reduce memory issues in that it will allow certain things to be dumped out of RAM faster because they are processed faster. However, in general, these are two separate topics. In your case, the issue is memory (RAM), not processor.


这篇关于VS 2008如何处理几个核心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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