Fundamentals of C++ Game Development: Dynamic Memory Allocation with new and delete

Fundamentals of C++ Game Development: Dynamic Memory Allocation with new and delete

Before discussing dynamic memory allocation, let’s first look at the two basic types of memory allocation in C++: Static memory allocation is used for static and global variables. The memory for these variables is allocated all at once when the program runs and lasts for the entire lifecycle of the program. Automatic memory allocation is … Read more

Understanding the Differences Between new/delete and malloc/free in C++

Understanding the Differences Between new/delete and malloc/free in C++

In memory management for C++ and C, new/delete and malloc/free are two core sets of tools, yet they have fundamental differences. malloc/free are library functions in C that are solely responsible for memory allocation and deallocation, without involving type information, returning a void * that requires manual casting. In contrast, new/delete are operators in C++ … Read more

Goodbye malloc/free: C++’s More Powerful Memory Management with new/delete

Goodbye malloc/free: C++'s More Powerful Memory Management with new/delete

In C, we often use the functions malloc and free for manual memory allocation and management. However, in C++, two operators, new and delete, are specifically designed to assist programmers in memory allocation and management, significantly simplifying memory management operations, especially for class objects. The new/delete operations are essential and should be learned and mastered. … Read more

Detailed Explanation of malloc() and new in C++

Detailed Explanation of malloc() and new in C++

Both malloc() and new serve the same purpose: they are used to allocate memory at runtime. However, malloc() and new differ in syntax. malloc() is a standard library function defined in the stdlib header file, whereas new is an operator. What is new? The new operator is used for memory allocation at runtime. The memory … Read more

Building a Raspberry Pi Home Server: Methods and Tips Explained

Building a Raspberry Pi Home Server: Methods and Tips Explained

In today’s rapidly advancing technology, home servers have gradually become an effective assistant for people to store data, share resources, and achieve smart home control. The Raspberry Pi, as a microcomputer, has become a popular choice for building home servers due to its low cost and high performance. Below is a detailed guide and tips … Read more

Understanding MCUBoot: A Universal Bootloader for MCU Systems

Understanding MCUBoot: A Universal Bootloader for MCU Systems

Explanation: 1. The Bootloader handles the initial boot sequence on hardware before the operating system takes over. For example, U-boot is often used as the boot loader in embedded systems before starting embedded operating systems like Linux or FreeBSD. MCUBoot is also a bootloader, but it targets IoT, referring here to systems with limited memory … Read more