Results for “mem”
Small, practical examples. Search by task or narrow things down below.
Read concatenated gzip members
Linux Commands: GNU gzip decompresses concatenated gzip members in order.
Linux Commands✓ Tested
Read from an in-memory filesystem
Read from an in-memory filesystem using a complete Go program with explicit sample inputs.
Go✓ Tested
Remember the previously committed value
Remember the previously committed value with a small React component and explicit browser behavior.
React✓ Tested
Set and inspect a memory limit
Apply a per-container limit when creating a container.
memory✓ Tested
Track which union member is currently valid
C: An explicit tag tells callers which overlaid union value to read.
C✓ Tested
Allocate an independent copy of a C string
C: Include one extra byte for the terminating null character.
C✓ Tested
Allocate and free a typed array
C: Use sizeof on the pointed-to type and check allocation success before writing.
C✓ Tested
Allocate and initialize a structure
C: Use a compound literal assignment to initialize all ordinary structure fields.
C✓ Tested
Check an array allocation size before multiplying
C: Compare the requested element count against SIZE_MAX divided by element size.
C✓ Tested
Check EEPROM capacity before a write
Arduino / C: length reports the available address count for this board.
Arduino / C✓ Tested
Clear an owning pointer after releasing its allocation
C: Assigning NULL helps prevent accidental reuse through the same variable.
C✓ Tested
Copy a flash string into a bounded RAM buffer
Arduino / C: strncpy_P reads from program memory into ordinary RAM.
Arduino / C✓ Tested