esto va a estar buenisimo
Memoria dinámica
El manejo de memoria
Punteros
Usando punteros
Estructuras de datos
Estructuras de datos
Creando nuestra primera estructura
Uniones y enumeraciones
Introducción a la Programación Orientada a Objetos
Qué es la Programación Orientada a Objetos
Creando nuestro primer objeto
El ciclo de vida de un objeto
Principios de la Programación Orientada a Objetos
Encapsulación
This
Static
Herencia
Herencia múltiple
Polimorfismo
Despedida
Conclusiones del curso
In object-oriented programming with C++, it is crucial to understand how the CPU and memory interact in a computer. The CPU, known as the brain of the computer, executes mathematical, logical and control operations. In parallel, the memory stores the program, including code and variables. The CPU and memory communicate continuously, allowing the program to run correctly.
When a program is executed, the operating system assigns it a space in RAM. This process involves a specific segmentation of memory to manage data efficiently. Although programming languages may differ in how they perform this segmentation, a standard approach is used in C++.
Instruction section: Houses the instructions of a program after the compilation process. These are loaded into this section of memory for execution.
Literal section: Contains constants and immutable values such as fixed strings. These do not change during program execution, as is the case with the strings displayed in a "Hello World".
Static data section: Here spaces are reserved for variables whose sizes are known in advance, such as integers or characters. The compiler is responsible for allocating a static space, ensuring that variables occupy the same number of bytes on the same computer, although it may vary between different machines.
Dynamic memory is segmented into two key parts: Heap memory and Stack memory. Both are essential for programs that need to modify the amount of data handled during execution.
Heap memory: It grows in the direction of the memory address numbers and is controlled by the programmer. The programmer decides how and when to free space, managing dynamic data entries, such as those coming from the user.
Stack memory: It also grows dynamically but in the opposite direction to the Heap. This part is mainly managed by the compiler, which keeps track of function calls and associated data.
In large programs, such as a complex spreadsheet where the number of cells and files is indeterminate, efficient memory management is needed. The operating system reserves an intermediate blank space that allows Heap and Stack memory to be developed in opposite directions, minimizing conflicts. However, uncontrolled growth can lead to a memory overflow, a common error in C++ that requires manual handling by the programmer. Modern languages offer automatic solutions to this problem, but C++ challenges its users to take more direct control.
The next step on the path to object-oriented programming with C++ will be to master pointers, which allow you to directly access and control memory registers, thus performing deeper program management. With this foundation in memory, you are getting closer to becoming an expert in C++. Don't stop and keep getting stronger in this exciting learning experience!
Contributions 17
Questions 1
esto va a estar buenisimo
Cuando hablemos del manejo de memoria en las computadoras, debemos tener en cuenta estos dos componentes:
Estos dos componentes se comunicarán entre si de manera constante. La RAM almacena la información a ejecutar y el CPU es quien lee esa información y la ejecuta
La RAM tiene una tarea mucho más especifica, que es la memoria de segmentacion. Nuestro sistema operativo lo que hace es gestionar los recursos en nuestra computadora, y cuando comienza nuestro programa a ejecutarse, el sistema operativo crea un espacio en la memoria para que pueda ejecutar dicho programa
Secciones en la Segmentacion de la memoria:
//Ejemplo 1
cout << "Hola mundo";
//Ejemplo 2
char dorime[6] = 'Dorime';
cout << dorime;
Acerca del Desbordamiento de Datos…
Un desbordamiento de búfer (buffer overflow o buffer overrun) es un error de software que se produce cuando un programa no controla adecuadamente la cantidad de datos que se copian sobre un área de memoria reservada.
Si la cantidad es superior a la capacidad preasignada, los bytes sobrantes se almacenan en zonas de memoria adyacentes, sobrescribiendo su contenido original, y que probablemente pertenecían a datos o código almacenados en memoria. Esto constituye un fallo de programación.
Pueden revisar más en Wikipedia Desbordamiento de bufer 👀
La presentación del video la pueden encontrar aquí 😃
no se nada de c++, estoy estudiandoo js, apenas se de POO.
pero, me dio curiosidad ver como funciona todo en c++, asi que. Veremos que sucede ajaj
Dejo el link del proyecto del github de la profesora para lo que tengan errores o quieran analizar el codigo:
En la edicion se quedo la diapositiva de manejo de memoria punteros.
No se ven la memoria stack, heap o static en la diapositiva. 😃
asta que veo que alguien explica bien lo que son punteros
Muy buena introducción!
Memory overflow ocurre cuando el Heap y el Stack colisionan (respecto a las direcciones de memoria).
Want to see more contributions, questions and answers from the community?