mitigating fragmented heap
This commit is contained in:
@@ -2086,6 +2086,13 @@ bool GfxRenderer::storeBwBuffer() {
|
||||
}
|
||||
}
|
||||
|
||||
if (bwBufferChunkSize > 1024) {
|
||||
LOG_INF("GFX", "BW buffer allocation still failed, retrying with 1024");
|
||||
if (attemptStore(1024)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_ERR("GFX", "!! BW buffer storage failed after retrying smaller chunk sizes");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void EpubReaderMenuActivity::buildMenuItems(bool hasFootnotes, bool hasStarredPa
|
||||
// Embedded style: cycles default(-1) -> ON(1) -> OFF(0) via DynamicEnum indices 0/1/2
|
||||
menuItems.push_back(SettingInfo::DynamicEnumCtx(
|
||||
StrId::STR_EMBEDDED_STYLE, {StrId::STR_DEFAULT_VALUE, StrId::STR_STATE_ON, StrId::STR_STATE_OFF}, self,
|
||||
[](void* ctx) -> uint8_t {
|
||||
[](const void* ctx) -> uint8_t {
|
||||
const auto* s = static_cast<const EpubReaderMenuActivity*>(ctx);
|
||||
if (s->pendingEmbeddedStyleOverride < 0) return 0;
|
||||
if (s->pendingEmbeddedStyleOverride > 0) return 1;
|
||||
@@ -76,7 +76,7 @@ void EpubReaderMenuActivity::buildMenuItems(bool hasFootnotes, bool hasStarredPa
|
||||
StrId::STR_IMAGES,
|
||||
{StrId::STR_DEFAULT_VALUE, StrId::STR_IMAGES_DISPLAY, StrId::STR_IMAGES_PLACEHOLDER, StrId::STR_IMAGES_SUPPRESS},
|
||||
self,
|
||||
[](void* ctx) -> uint8_t {
|
||||
[](const void* ctx) -> uint8_t {
|
||||
const auto* s = static_cast<const EpubReaderMenuActivity*>(ctx);
|
||||
return (s->pendingImageRenderingOverride < 0) ? 0 : (s->pendingImageRenderingOverride + 1);
|
||||
},
|
||||
@@ -88,7 +88,7 @@ void EpubReaderMenuActivity::buildMenuItems(bool hasFootnotes, bool hasStarredPa
|
||||
// Text darkness: straightforward 0-3 cycle
|
||||
menuItems.push_back(SettingInfo::DynamicEnumCtx(
|
||||
StrId::STR_TEXT_DARKNESS, {StrId::STR_NORMAL, StrId::STR_DARK, StrId::STR_EXTRA_DARK, StrId::STR_MAX_DARK}, self,
|
||||
[](void* ctx) -> uint8_t { return static_cast<EpubReaderMenuActivity*>(ctx)->pendingTextDarkness; },
|
||||
[](const void* ctx) -> uint8_t { return static_cast<const EpubReaderMenuActivity*>(ctx)->pendingTextDarkness; },
|
||||
[](void* ctx, uint8_t v) { static_cast<EpubReaderMenuActivity*>(ctx)->pendingTextDarkness = v; }));
|
||||
|
||||
// Helper functions, reading ruler, auto page turn, orientation
|
||||
@@ -99,7 +99,7 @@ void EpubReaderMenuActivity::buildMenuItems(bool hasFootnotes, bool hasStarredPa
|
||||
menuItems.push_back(SettingInfo::DynamicEnumCtx(
|
||||
StrId::STR_ORIENTATION,
|
||||
{StrId::STR_PORTRAIT, StrId::STR_LANDSCAPE_CW, StrId::STR_INVERTED, StrId::STR_LANDSCAPE_CCW}, self,
|
||||
[](void* ctx) -> uint8_t { return static_cast<EpubReaderMenuActivity*>(ctx)->pendingOrientation; },
|
||||
[](const void* ctx) -> uint8_t { return static_cast<const EpubReaderMenuActivity*>(ctx)->pendingOrientation; },
|
||||
[](void* ctx, uint8_t v) { static_cast<EpubReaderMenuActivity*>(ctx)->pendingOrientation = v; }));
|
||||
|
||||
// --- Synchronisation (only if credentials are set) ---
|
||||
|
||||
@@ -53,7 +53,7 @@ struct SettingInfo {
|
||||
// Function pointers + opaque context avoid the heap allocation of std::function. Stateless
|
||||
// lambdas pass ctx=nullptr; captures must be hand-written as trampoline functions. See
|
||||
// DynamicEnumCtx / DynamicStringCtx factories below.
|
||||
using ValueGetterFn = uint8_t (*)(void*);
|
||||
using ValueGetterFn = uint8_t (*)(const void*);
|
||||
using ValueSetterFn = void (*)(void*, uint8_t);
|
||||
using StringGetterFn = std::string (*)(void*);
|
||||
using StringSetterFn = void (*)(void*, const std::string&);
|
||||
|
||||
Reference in New Issue
Block a user