Skip to content

Repeatedly FFT-ing an array throws ArgumentOutOfRangeException #9

@DumpsterDoofus

Description

@DumpsterDoofus

Possibly related to #6. Minimal-ish repro steps:

var array = new double[200, 200];
for (var i = 0; i < 3; i++)
{
    using var input = new PinnedArray<double>(array);
    using var inputFft = new PinnedArray<Complex>(DFT.GetComplexBufferSize(input.GetSize()));
    DFT.FFT(input, inputFft);
    Console.WriteLine("Success");
}

Running this yields:

Success
Success
Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at FFTW.NET.BufferPool`1.Container.Get(BufferPool`1 bufferPool, Int32 minSize)
   at FFTW.NET.BufferPool`1.RequestBuffer(Int32 minSize)
   at FFTW.NET.DFT.FFT(IPinnedArray`1 input, IPinnedArray`1 output, PlannerFlags plannerFlags, Int32 nThreads)
   at Test.Program.Main() in C:\Users\peter\source\repos\Test\Test\Program.cs:line 20

It also appears to be array size-dependent (for example, using double[100, 100] fails to reproduce the issue). I haven't dug into why it's failing on the third FFT, or where the size-dependence comes from.

@ArgusMagnus I'm going to try the fix that @liaody proposed. If that makes it go away, I'll update here and maybe file a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions