Diskussion:C++-Programmierung/ Speicherverwaltung/ Stack und Heap

Seiteninhalte werden in anderen Sprachen nicht unterstützt.
Aus Wikibooks

Unverständlich[Bearbeiten]

Die vom Verfasser eingedeutschen Begriffe machen den Text unverständlich -- ‎176.94.129.91 13:31, 7. Feb. 2014 (Signatur nachgetragen von: Jürgen 15:23, 7. Feb. 2014 (CET) -- bitte künftig mit 4 Tilden ~~~~ selbst erledigen)[Beantworten]

Stapelspeicher sollte nicht als statischer Speicher bezeichnet werden[Bearbeiten]

Die statische Speicherverwaltung wird im Artikel fälschlicherweise gänzlich dem Stapelspeicher zugesprochen. Der statische Bereich kann ebenfalls als Einteilung "Static Memory" angesehen werden und sollte nicht mit dem Stapelspeicher "Stack" komplett vermengt werden. So heißt es z.B. für Static Memory für C:

This memory can come from one of two places. If a variable is declared outside of a function, it is considered global, meaning it is accessible anywhere in the program. Global variables are static, and there is only one copy for the entire program. Inside a function the variable is allocated on the stack. It is also possible to force a variable to be static using the static clause. For example, the same variable created inside a function using the static clause would allow it to be stored in static memory.[1].

Für C/C++ Memory Spaces ergibt sich somit eine Anschauungsebene für Speichereinteilungen jenseits des Stack/Heap Dualismus (ohne Angabe der feineren Unterschiede zwischen C/C++), genauer mit: Static memory, Automatic variables, Dynamic Memory. So gilt für z.B. für Static Memory:

The keyword static does not generally affect where such variables are located; it specifies their scope to be local to the current module. Variables that are defined inside of a function, which are explicitly declared static, are also stored in static memory. Commonly, static memory is located at the beginning of the RAM area. The actual allocation of addresses to variables is performed by the embedded software development toolkit: a collaboration between the compiler and the linker. [2].

Für Automatic variables: "The end of the dynamic storage area is typically used for the stack." [2]

(von: Chrisoutwright 14:59, 4. Sep. 2020 (CEST))[Beantworten]

Hallo Prog! Falls du das nicht gesehen hast! Ich kenne mich da nicht aus... LG Yomomo 20:28, 4. Sep. 2020 (CEST)[Beantworten]

  1. Siehe Blog-Eintrag von Martin Muguna: Memory in C – The Stack, The Heap, and Static. Website. Abgerufen am 04. September 2020.
  2. 2,0 2,1 Siehe Blog-Eintrag von Colin Walls: Dynamic Memory Allocation and Fragmentation in C and C++ Website. Abgerufen am 04. September 2020.