--- nono/vm/tvram.cpp 2026/04/29 17:05:33 1.1.1.12 +++ nono/vm/tvram.cpp 2026/04/29 17:05:43 1.1.1.14 @@ -26,12 +26,8 @@ TVRAMDevice::TVRAMDevice() ClearAlias(); AddAlias("TVRAM"); - uint devlen = 512 * 1024; - // プレーン数は4枚固定 nplane = NPLANE; - - mem.reset(new uint8[devlen]); } // デストラクタ @@ -47,6 +43,13 @@ TVRAMDevice::Init() return false; } + constexpr uint devlen = 512 * 1024; + mem.reset(new(std::nothrow) uint8[devlen]); + if ((bool)mem == false) { + warnx("Cannot allocate %u bytes at %s", devlen, __method__); + return false; + } + videoctlr = GetVideoCtlrDevice(); // 加工済みパレットを取得