-
-
Notifications
You must be signed in to change notification settings - Fork 5
Memory management
This is an introduction to the custom memory management strategies you should be using to be writing "correct" code.
The framework ships with a custom allocator(UImGui::Allocator
) that should be used by your application. It contains all functions a standard C++ custom allocator should have.
This is needed to enable us to have plugins on Windows. It's good practice to use the custom allocator, however, it should be compatible with the normal standard allocator in most cases if you don't want to support plugins on Windows.
Caution
Make sure that you're using the correct wrappers on top of the regular standard library types. Standard library containers should not be used as is. More info can be found here.
In the C API, you also have access to the following function as replacements for malloc
and free
:
UImGui_Allocator_allocate
UImGui_Allocator_deallocate
The C API provides you with 2 ways of managing your memory:
- Auto-deallocated - for objects that have relatively the same lifetime as the application
- Manually managed
In many interfaces, you can decide which deallocation strategy you want to use for a handle, by toggling the bManualDeallocation
boolean argument that should be the last argument of the function that returns the handle. You can then call the respective free
function for it.
This project is supported by all the people who joined our discord server and became beta testers. If you want to join the discord you can click here.
- Home
- Beginner content
- Install guide
- Creating and using the UI components
- The Instance
- The Init Info struct
- Textures
- Logging
- Unicode support
- Additional features
- Client-side bar
- Custom type definitions
- Memory management
- C API development
- Config files and Folders
- Interfaces
- Internal Event safety
- Customising the build system
- Modules system
- Collaborating with others
- Advanced content
- Developer and contributor resources
- Misc