JuliaDSP/DSP.jl — pull request #94 by r9y9 (2014-12-31 14:33:04+00:00)
Title: use the type `Plan` instead of a raw pointer of fftw_plan so that the finalizer is called property

This fixes a segfault problem which could happen when a finalizer runs before executing FFT.

In the current implementation, `forward_plan` creates `Plan` for a FFT and returns a raw pointer of fftw_plan (not `Plan`), so the finalizer of `Plan` could be called before executing FFT. When the finalizer called depends on when the garbage collection runs, so the segfault problem doesn't always appear but I have encountered this problem at this time.

For the information, explicit `gc()` call after `forward_plan` in the current implementation could produce the segfault problem.

For details of finalizer of `Plan`:
https://github.com/JuliaLang/julia/blob/master/base/fftw.jl#L215-L217