Shared Flashcard Set

Details

Systems Terms: Dynamic Memory Allocation
Terms from Lecture 11 of my Systems class
9
Computer Science
Graduate
03/03/2025

Additional Computer Science Flashcards

 


 

Cards

Term
Reasons to use the heap and not the stack (2)
Definition
1) Long-lived data
2) We don't know what data will be coming in ahead of time
Term
What happens if we have a function that returns a pointer to something that was stored on the stack?
Definition
Seg fault
Term
What is in a stack frame? (3)
Definition
1) Parameters
2) Local variables
3) Return address
Term
malloc function signature
Definition
void *malloc(size_t size);
Term
free function signature
Definition
void free(void *ptr)
Term
What happens if you try to access a variable that has already been freed?
Definition
Anything can happen!
Term
calloc function signature
Definition
void *calloc(size_t nmemb, size_t size);
Term
realloc function signature
Definition
void *realloc(void *ptr, size_t size);
Term
How to check the return address of realloc
Definition
some_ptr = realloc(some_ptr, size);
Supporting users have an ad free experience!