Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Heap, dynamic allocation?

También llamado: heap (memory) · dynamic allocation

Definition 5.1 University Computer Science — Year 1 · Capítulo 5 — Dynamic Memory

The heap is the region of a running program’s memory from which blocks are handed out on request while it runs. Dynamic allocation is the obtaining of such a block: malloc(n) returns the address of a new block of n bytes, or the null pointer if it cannot. The block exists until the program passes its address to free, whatever functions return in between.

Near the end of . The pointers live in main’s frame; the blocks they hold the addresses of live on the heap. The first block has been freed: squares still holds its address, but the block is no longer the program’s.
Near the end of Listing 5.1. The pointers live in main’s frame; the blocks they hold the addresses of live on the heap. The first block has been freed: squares still holds its address, but the block is no longer the program’s.
Two lifetimes. A local of f ends when f returns; a block that f obtains from malloc lasts until some part of the program frees it, possibly far from f. The programmer, not the call structure, chooses when.
Two lifetimes. A local of f ends when f returns; a block that f obtains from malloc lasts until some part of the program frees it, possibly far from f. The programmer, not the call structure, chooses when.
Leer en el capítulo →