To calculate fast Fourier conversion of discrete time signal, one of the unmanaged C ++ code from your C # application Call the slice.
I make some calls like this
IntPtr ptr = ComputeFFTW (packet sig, packet sig. Lang, (INA) samplefracquency, (int) fftpint); Unsafe {double * DPTR = (double *) PTR; For (Int L = 0; L & LT; FFTDTA langti; L ++) {fftData [l] = DPTR [L]; Although this snippet of code works fine and gives me the desired result, I can see that the calculation is going on, whereas the performance is like a hit (memory leak). CLR fails to retrieve the local (dual) variable and the RAM space in my application raises quite a lot. Can any of you suggest the places where I am doing wrong?
On my side, I ran my application using the ANS Mem Profiler and on the snapshot I can see that double objects almost claim> 150 MB of memory space claim. Is this a normal behavior?
class name live size (bytes) live instance double [] 150,994 9 80 3
Any help in this regard is appreciated. / P>
You use the Marshall.coop method (IntPtr, Double [], Int32, Int32) to add Can handle unmanaged ptr-managed ffData array from double values
IntPtr ptr = ComputeFFTW (packet sig, packet sig. Lang, (int) samplefrequency, (int) fftpint); Marshall Coppie (PTR, FFTData, 0, FFTDTTA.LANG);
If ComputeFFTW assigns the pointer to the dynamically allocated memory, you need to release it after using it. Create it in unmanaged code, add it to PTR such as release and function.
Comments
Post a Comment