FIND YOUR NEXT FEW LINES

Results for “Dynamic memory & ownership”

Small, practical examples. Search by task or narrow things down below.

64 snippets foundClear filters
C++Ownership & optional values

Share ownership with a counted smart pointer

C++: Copies of shared_ptr keep the owned value alive until the last owner is released.

C++✓ Tested
C++Ownership & optional values

Transfer unique ownership with move

C++: Moving a unique_ptr leaves the source empty and gives ownership to the destination.

C++✓ Tested
JavaText validation & formatting

Treat dynamic regex input as literal text

Java: Use Pattern.quote so metacharacters in a search term lose their special meaning.

Java✓ Tested
C++Ownership & optional values

Apply an operation to a variant’s active value

C++: A generic visitor lets the compiler check behavior for every possible alternative.

C++✓ Tested
RustThreads & shared ownership

Borrow local data in a scoped thread

Borrow local data in a scoped thread in a complete Rust program using the standard library.

Rust✓ Tested
C++Ownership & optional values

Capture configuration by value in a callable

C++: A value capture retains the value from lambda creation even if the original variable changes later.

C++✓ Tested
Arduino / CEEPROM & program memory

Check EEPROM capacity before a write

Arduino / C: length reports the available address count for this board.

Arduino / C✓ Tested
Arduino / CEEPROM & program memory

Copy a flash string into a bounded RAM buffer

Arduino / C: strncpy_P reads from program memory into ordinary RAM.

Arduino / C✓ Tested
RustThreads & shared ownership

Initialize shared data once

Initialize shared data once in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Join a worker thread and read its result

Join a worker thread and read its result in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Move owned data into a worker

Move owned data into a worker in a complete Rust program using the standard library.

Rust✓ Tested
RustThreads & shared ownership

Protect shared mutable state with a mutex

Protect shared mutable state with a mutex in a complete Rust program using the standard library.

Rust✓ Tested