Posts

Showing posts from December, 2025

smart pointers in C++

Smart Pointers To understand smart pointers we must understand normal pointers.  By default, objects in C++ are placed on the stack. The stack is sequential, quick-access storage that also doesn’t have a ton of room. It is LIFO, like a pancake stack. The memory management is automatic.  What do we do when we need more room? We go to the heap. The heap is dynamically allocated memory. That means that we choose when to use it, and when to release it.  A pointer is how we put things on the heap. It’s an object in the stack that HAS A REFERENCE to a heap location.  With raw pointers, we create them ourselves, and delete them ourselves. However, there is a risk of leaking memory caused by  Freeing up heap memory that didn’t need to be freed  Forgetting to free up heap memory Now, we get to smart pointers. These remove us from the responsibility of manually getting rid of memory, but they are still more effective than garbage collection in other lang...

Advent of Code and Advent of Cyber

TryHackMe is down right now BUT  Maybe I should attempt both challenges this year.  Other challenges I try annually are Art Fight and Drawtober.  I don't usually nail them. But with practice I will get there.  I keep thinking I should do the Rough Draft Challenge in November for writing (replacing NaNo), but I'm never at a good stopping point with my current WIP to just crank out words.