Tencent C++ Early Interview: How Does Delete Release Memory Without Knowing Its Size?

Tencent C++ Early Interview: How Does Delete Release Memory Without Knowing Its Size?

In the world of C++ programming, memory management is a crucial topic that developers cannot avoid. When we use the delete keyword to release memory, an interesting question arises: how does delete accurately complete the memory release task when it does not know the size of the memory being operated on? It’s like trying to … 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

An Overview of HTTP Request Methods

An Overview of HTTP Request Methods

Mind Map The HTTP request methods currently in mainstream use are quite fixed and have not changed significantly with major version upgrades. According to common, uncommon, and extended, they can be divided into the 3 categories shown above.To thoroughly understand these request methods, we need to consider several aspects: What was the original intention behind … Read more

Understanding Free() vs Delete() in C++

Understanding Free() vs Delete() in C++

In this topic, we will learn about the free() function and the delete operator in C++. free() Function In C++, the free() function is used to dynamically release memory. It is a library function used in C++, defined in the stdlib.h header file. This library function is used for pointers pointing to memory allocated using … Read more