Files
Renderive/tests/Memory_Plot_Late_Config.cpp
T
2026-07-30 08:07:43 +08:00

29 lines
888 B
C++

#include <QApplication>
#include <stdexcept>
#include "../Renderive/architecture/Plot.h"
#include "../Renderive/base/Memory.h"
namespace {
void* callback_allocate(void*, std::size_t size, std::size_t alignment) {
return std::pmr::new_delete_resource()->allocate(size, alignment);
}
void callback_deallocate(void*, void* address, std::size_t size, std::size_t alignment) {
std::pmr::new_delete_resource()->deallocate(address, size, alignment);
}
}
int main(int argc, char** argv) {
QApplication app(argc, argv);
renderive::start_render_scheduler();
renderive::Plot plot;
plot.init();
renderive::Memory_Callbacks callbacks;
callbacks.allocate = callback_allocate;
callbacks.deallocate = callback_deallocate;
try {
renderive::set_memory_callbacks(callbacks);
}
catch (const std::logic_error&) {
return 0;
}
return 1;
}