English 中文(简体)
C/C++未分配记忆
原标题:Failure on allocating memory in C/C++
  • 时间:2012-04-29 07:56:18
  •  标签:
  • c++
  • c

I have C implementation of an algorithm that includes shared library. The performance of the shared library is considerably different in C and C++ (performing much better in C++). Therefore, I have changed the shared library parts of the C implementation (Imp-1) into C++ (Imp-2) while keeping the rest of it same. I have compiled Imp-1 and Imp-2 by using gcc and g++ in Linux, respectively. In small sized problems both Imp-1 and Imp-2 perform exactly same. However, in a same large sized problem while Imp-1 solves it without any problem, Imp-2 returns std::bad_alloc error. Interestingly, this error occurs when the memory usage increases to 4GB where the available memory is 35GB.

为什么出现这一错误? (研究员、操作系统、汇编办法等)

最佳方面。

最佳回答

看来,您的缩略语是64位比方的汇编者,作为2个比方的汇编者。 即便是你在32个轨道系统上运行,除非你以64个比值汇编者汇编你的节目,否则你的方案不能充分利用64个比值处理能力,而如果你想解决4个以上的大不列颠和黑帮的话,这种能力就会变得不好。

我相信,你正在实施一项在64个轨道上编纂的32个范围的方案,这就是4个性别界限。 一般来说,随着用户/地球空间和32个轨道系统无法提供整个4GB,通常为2GB和3GB之间,记忆是分不开的。 由于你可以解决整个4个大不列颠和加勒比的问题,似乎你正在64个轨道环境中实施32个比照方案。

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签