mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
make debug allocator work under proton (?)
This commit is contained in:
parent
318a7f2921
commit
6516adb557
1 changed files with 9 additions and 10 deletions
19
entry.cpp
19
entry.cpp
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue