10
Managing Resources
In the previous chapter, we recapped the communication mechanisms between Lua and C++. In this chapter, we will learn more about managing resources. Resources can be anything an object uses, such as memory, files, or network sockets.
We will cover the following topics:
- Customizing Lua memory allocation
- Delegating C++ object memory allocation to Lua
- What is RAII?
Technical requirements
We will use the source code for Chapter 9 as a base to develop the examples in this chapter. Make sure you can access the source code for this book: https://github.com/PacktPublishing/Integrate-Lua-with-CPP/tree/main/Chapter10.
Customizing Lua memory allocation
In the Lua runtime, memory is allocated, reallocated, or deallocated in the heap ...
Get Integrate Lua with C++ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.