堆腐败了吗? [英] Heap corrupted?

查看:76
本文介绍了堆腐败了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的硬件是HP Pavilion。操作系统 - Windows 10.我有微软的V​​isual Studio 2017。这是一个社区版。这个当前项目是用C ++编写的Win32控制台应用程序。

MY hardware is HP Pavilion. OS - Windows 10. I have Visual Studio 2017 by Microsoft. It is a Community Edition. This current project is Win32 Console application in C++.

我有这段代码。它是所谓的Librow FFT的一部分。我试图发布一个链接,但论坛不允许我说我的帐户尚未验证。

I have this code. It is a part of so called Librow FFT. I've tried to post a link but the forum does not allow me to do it saying that my account has not been verified yet.

		 //   FFT implementation
private: void Perform (dcomp *const Data, const unsigned int N, const bool Inverse)
{                   // Inverse = false
	const double pi = Inverse ? 3.14159265358979323846 : -3.14159265358979323846;
	//   Iteration through dyads, quadruples, octads and so on...
	for (unsigned int Step = 1; Step < N; Step <<= 1)
	{
		//   Jump to the next entry of the same transform factor
		const unsigned int Jump = Step << 1;
		const double delta = pi / double(Step);    //   Angle increment
												   //   Auxiliary sin(delta / 2)
		const double Sine = sin(delta * .5);  // <=== UNHANDLED EXCEPTION.
		//   Multiplier for trigonometric recurrence
		const dcomp Multiplier(-2. * Sine * Sine, sin(delta));
		//   Start value for transform factor, fi = 0
		dcomp Factor(1.0,0.0);
		//   Iteration through groups of different transform factor
		for (unsigned int Group = 0; Group < Step; ++Group)
		{
			//   Iteration within group 
			for (unsigned int Pair = Group; Pair < N; Pair += Jump)
			{
				const unsigned int Match = Pair + Step;    //   Match position				
				dcomp Product = dcomp(Factor * Data[Match]);   //   Second term of two-point transform
															 //   Transform for fi + pi
//				Data[Match] = Data[Pair] - Product;   // old statement
				Data[Match] = dcomp ((Data[Pair]).Real - Product.Real, (Data[Pair]).Imaginary - Product.Imaginary);  
				//   Transform for fi
				Data[Pair] += Product;
			}
			//   Successive transform factor via trigonometric recurrence
			Factor = Multiplier * Factor + Factor;
		}
	}
}                          // Perform

程序编译,我运行了几次,没有任何反应,然后全部我突然得到了这个:

The program compiles and I have run it a few times and nothing happened, then all of a sudden I got this:

Unhandled exception at 0x76F79D11 (ntdll.dll) in VerificationOfConcepts.exe: 0xC0000374: A heap has been corrupted (parameters: 0x76FAD8D0). occurred

我右键单击然后"运行到光标"。当我将光标定位在程序的末尾时,会发生上述异常。相反,如果我使用F5,则代码将运行该语句,并在调用例程结束时使用 相同的
消息进行分解:

I do right click and then "run to the cursor." The above exception happens when I position the cursor at the end of the program. If instead I use F5 then the code runs past that statement and breaks down at the end of the calling routine with identical message:

Unhandled exception at 0x76F79D11 (ntdll.dll) in VerificationOfConcepts.exe: 0xC0000374: A heap has been corrupted (parameters: 0x76FAD8D0). occurred


如有必要,我可以发布调用例程。相同的代码在Ubuntu中运行完美,但我现在需要在Windows 10中移植它。那么,为什么我会收到此错误?我检查了档案,似乎这个问题不是唯一的,但是因为各种
的原因发生同样的异常,我找不到类似于我的东西。

I can post the calling routine if necessary. The same code runs flawlessly in Ubuntu but I need to port it now in Windows 10. So, why do I get this error? I checked the archives and it seems this problem is not unique but the same exception happens for various reasons and I could not find anything similar to mine.

推荐答案

2017年5月20日下午3:32,MyCatAlex写道:

On 5/20/2017 3:32 PM, MyCatAlex wrote:


  for(unsigned int Step = 1; Step< N; Step<< = 1)

  &NBSP; &NBSP; for(unsigned int Pair = Group; Pair< N; Pair + = Jump)

  &NBSP; &NBSP; {

  &NBSP; &NBSP; &NBSP; const unsigned int Match = Pair + Step;  &NBSP; //&NBSP;&NBSP;比赛位置  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; dcomp Product = dcomp(Factor * Data [Match]);   //&NBSP;&NBSP;
两点变换的第二项

  for (unsigned int Step = 1; Step < N; Step <<= 1)
      for (unsigned int Pair = Group; Pair < N; Pair += Jump)
      {
        const unsigned int Match = Pair + Step;    //   Match position                dcomp Product = dcomp(Factor * Data[Match]);   //   Second term of two-point transform

数据阵列有多大?它至少有2 * N-1个元素吗?匹配可以大到2 * N-2。

How large is Data array? Does it have at least 2*N-1 elements? Match can be as large as 2*N-2.


这篇关于堆腐败了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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