CMPSC 311 – Memory Management Vocabulary

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/33

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards summarizing key memory-management terms from the CMPSC 311 lecture.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

34 Terms

1
New cards

Pointer

A variable that stores the memory address of another variable.

2
New cards

Pointer Arithmetic

Operations on pointers that add or subtract multiples of the pointed-to type’s size (e.g., int_ptr+1 advances by sizeof(int)).

3
New cards

Double Pointer (e.g., char **, int **)

A pointer whose value is the address of another pointer; used to reference pointers indirectly.

4
New cards

Stack Frame

Region of stack memory allocated for a single function call, holding its local variables and return info.

5
New cards

Heap

Large pool of memory used for dynamic (runtime) allocation via malloc/calloc/realloc and released with free.

6
New cards

Static Allocation

Memory allocated at program load time (e.g., global variables); freed only when program exits.

7
New cards

Automatic Allocation

Memory allocated when a function is called (locals on the stack) and freed when the function returns.

8
New cards

Dynamic Allocation

Memory explicitly requested at runtime that persists until the program frees it (heap memory).

9
New cards

malloc

C library function that allocates a raw block of memory of a given size and returns a void* pointer to it.

10
New cards

calloc

Like malloc but additionally sets the allocated memory to all zero bytes; takes element count and size.

11
New cards

realloc

Resizes a previously allocated heap block; may move the data to a new location and returns new pointer.

12
New cards

free

Releases a heap block previously obtained from malloc/calloc/realloc; pointer becomes invalid afterward.

13
New cards

Dangling Pointer

A pointer that references memory that has already been freed, leading to undefined behavior if dereferenced.

14
New cards

NULL

A guaranteed invalid pointer value (0x0 on Linux); dereferencing it causes a segmentation fault.

15
New cards

Memory Leak

Dynamically allocated memory that is never freed, causing a program’s memory usage to grow over time.

16
New cards

Memory Corruption

Unintended modification of memory due to bugs such as buffer overflows, invalid frees, or bad arithmetic.

17
New cards

Buffer

A contiguous block of memory used to temporarily hold data, typically referenced through a pointer.

18
New cards

Void Pointer (void *)

A generic, untyped pointer; must be cast to an appropriate type before dereferencing.

19
New cards

memcpy

Standard function that copies n bytes from a source buffer to a destination buffer.

20
New cards

memset

Fills n bytes of a buffer with a constant byte value.

21
New cards

memcmp

Compares two memory regions byte-by-byte for n bytes; returns

22
New cards

Program Break

The current end of the process’s heap region; moved up or down as the heap grows or shrinks.

23
New cards

sbrk

System call that increments (or decrements) the program break by a specified number of bytes.

24
New cards

brk

System call that sets the program break to an absolute address; dangerous if misused.

25
New cards

Garbage Collection

Automatic reclamation of unused memory by a runtime system (absent in C, present in Java, Python, etc.).

26
New cards

Buffer Splicing

Using memcpy to copy a smaller buffer into an offset inside a larger buffer (e.g., &buf1[2]).

27
New cards

AddressSanitizer

Compiler-integrated tool (-fsanitize=address) that detects memory errors such as leaks or out-of-bounds accesses.

28
New cards

Valgrind

Dynamic analysis tool that detects memory leaks, invalid accesses, and other memory errors at runtime.

29
New cards

Heap Allocator

Library implementation (e.g., dlmalloc, tcmalloc, jemalloc) that manages requests to malloc/free.

30
New cards

Overcommit (Linux)

Kernel feature where malloc may never fail immediately because the OS promises more memory than is physically available.

31
New cards

Buffer Overflow

Writing past the end of a buffer, potentially corrupting adjacent memory.

32
New cards

Endianess (Little Endian)

Byte order where least-significant byte is stored at the lowest address; affects pointer casting to char*.

33
New cards

Struct Allocation

Using sizeof(struct) with malloc/calloc to dynamically allocate space for structures.

34
New cards

Memory Debugger

Toolset used to detect memory misuse; examples include Purify, Valgrind, AddressSanitizer.