Concept:

Manual memory management

Headline

The most basic Memory management technique: the programmer has to explicitly allocate and deallocate their dynamic memory.

Illustration

Take for example Language:CPlusPlus, where if an array's size is not known at compile time, it must be dynamically allocated:

void
doStuff(const size_t& length)
{
    int  automatic[] = {1,2,3,4,5};     // size known at compile time, no need for dynamic memory
    int* dynamic     = new int[length]; // size not known, need to use new[]
    // do something interesting
    delete[] dynamic;
}

This approach is obviously very easy to implement and doesn't incur any overhead, but it can also very easily lead to Memory leaks. If in the above example the "do something interesting" part can throw an exception, there is potential for a leak.


Marcel Heinz edited this article at Tue, 06 Jun 2017 09:56:52 +0200
Compare revisions Compare revisions

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.