Static memory allocation

Static memory allocation

Static memory allocation refers to the process of allocating memory at compile-time before the associated program is executed, unlike dynamic memory allocation or automatic memory allocation where memory is allocated as required at run-time.

An application of this technique involves a program module (e.g. function or subroutine) declaring static data locally, such that these data are inaccessible in other modules unless references to it are passed as parameters or returned. A single copy of static data is retained and accessible through many calls to the function in which it is declared. Static memory allocation therefore has the advantage of modularising data within a program design in the situation where these data must be retained through the runtime of the program.

The use of static variables within a class in object oriented programming enables a single copy of such data to be shared between all the objects of that class.

Object constants known at compile-time, like string literals, are usually allocated statically. In object-oriented programming, the virtual method tables of classes are usually allocated statically. A statically defined value can also be global in its scope ensuring the same immutable value is used throughout a run for consistency.

ee also

Global variable


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • static memory allocation — statinis atminties paskyrimas statusas T sritis informatika apibrėžtis Atminties paskyrimas ↑statiniam kintamajam programos veikimo pradžioje. Paskyrimas išlieka, kol veikia programa. atitikmenys: angl. static allocation; static memory allocation …   Enciklopedinis kompiuterijos žodynas

  • static memory allocation — noun The process of allocating fixed memory at compile time …   Wiktionary

  • Dynamic memory allocation — In computer science, dynamic memory allocation is the allocation of memory storage for use in a computer program during the runtime of that program. It can be seen also as a way of distributing ownership of limited memory resources among many… …   Wikipedia

  • C dynamic memory allocation — C Standard Library Data types Character classification Strings Mathematics File input/output Date/time Localization …   Wikipedia

  • Memory management — is the act of managing computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. This is critical to …   Wikipedia

  • Memory segmentation — is the division of computer memory into segments or sections. Segments or sections are also used in object files of compiled programs when they are linked together into a program image, or the image is loaded into memory. In a computer system… …   Wikipedia

  • Memory leak — A memory leak, in computer science (or leakage, in this context), occurs when a computer program consumes memory but is unable to release it back to the operating system. In object oriented programming, a memory leak happens when an object is… …   Wikipedia

  • Memory management unit — This 68451 MMU could be used with the Motorola 68010 A memory management unit (MMU), sometimes called paged memory management unit (PMMU), is a computer hardware component responsible for handling accesses to memory requested by the CPU. Its… …   Wikipedia

  • Memory safety — Software Testing portal Memory safety is a concern in software development that aims to avoid software bugs that cause security vulnerabilities dealing with random access memory (RAM) access, such as buffer overflows and dangling pointers.… …   Wikipedia

  • static allocation — statinis atminties paskyrimas statusas T sritis informatika apibrėžtis Atminties paskyrimas ↑statiniam kintamajam programos veikimo pradžioje. Paskyrimas išlieka, kol veikia programa. atitikmenys: angl. static allocation; static memory allocation …   Enciklopedinis kompiuterijos žodynas

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”