开发者

How to deallocate memory on the iPhone?

开发者 https://www.devze.com 2023-02-18 14:36 出处:网络
This is probably a very silly and simple question to most of you, but I have the following code creating a temporary array within a function, at the end of the function i need to release the memory. H

This is probably a very silly and simple question to most of you, but I have the following code creating a temporary array within a function, at the end of the function i need to release the memory. Here is the code:

double *FFTOut;

//FFT Out removes the alternative zeros added in the earler phase (before the FFT)
FFTOut = (double *)malloc((CFArray1Size)* sizeof(double));

So the pointer FFTOut is to a block of memory, I have tried the following...

[FFTOut release];

and...

[FFTO开发者_如何学运维ut dealloc];

Neither of which work. I'm sorry to post such a trivial question, but i can't seem to find the answer to this? Unless I am allocating the memory incorrectly in the first place, but I don't think this is the case?

Many Thanks


If you malloc, you have to use free().

release is for objective-c object that you've either new'd or alloc'd.

0

精彩评论

暂无评论...
验证码 换一张
取 消