- release the allocated memory.
- free the allocated memory.
- delete the allocated memory.
What are the differences between them?
What are the differences between them? |
||||
|
|
|
Well, the differences have more to do with the computer language behind them. Delete is inappropriate. Assuming C++ or similar, an object is being deleted, and its associated memory is automatically freed thereafter. Free will be understood by any C-family programmer. Release probably will be too but when you are writing for a C audience, stick with C terminology. (Release is more often used with respect to a connection pool, an OS resource, but not memory—in C. In another language, your mileage may vary.) |
|||||||||||
|
|
Generally memory allocation in programming languages operates in pairs of functions, and as Andrew Lazarus states, this depends on the language in question. Manual memory management is most common in C-style languages, while many others (including Java) have automatic management through garbage collection etc, so the programmer has not to worry about allocating or deallocating memory. In C the functions are Objective-C uses mostly reference counting (which in the current version is done automatically), and here you create objects using In C++ you create objects with In a language-agnostic context I would say the first two (release/free) are mostly synonymous, while I would not use the third one at all. |
|||
|
|