make debug allocator work under proton (?)

This commit is contained in:
dankmeme01 2024-04-12 15:10:33 +02:00
parent 318a7f2921
commit 6516adb557

View file

@ -24,20 +24,19 @@ namespace {
// Without these, the game will very likely crash when the mod tries to free memory allocated by the game (or another non-debug mod).
static inline void* relallocthrow(size_t size) {
// void* p;
// while ((p = HeapAlloc(GetProcessHeap(), 0, size)) == 0) {
// if (_callnewh(size) == 0) {
// static const std::bad_alloc exc;
// throw exc;
// }
// }
void* p;
while ((p = HeapAlloc(GetProcessHeap(), 0, size)) == 0) {
if (_callnewh(size) == 0) {
static const std::bad_alloc exc;
throw exc;
}
}
return geode::stl::operatorNew(size);
return p;
}
static inline void relfree(void* block) {
// HeapFree(GetProcessHeap(), 0, block);
geode::stl::operatorDelete(block);
HeapFree(GetProcessHeap(), 0, block);
}
void* operator new(size_t size) {