From 40755e165d692d23afa62078d234fa638f0b1fcc Mon Sep 17 00:00:00 2001 From: Saran Tunyasuvunakool Date: Wed, 5 Jun 2024 06:26:12 -0700 Subject: [PATCH] Reduce VeryLargeMemory test memory allocation in engine_io_test.cc An upcoming LLVM update is due to make this test fail under msan, since msan touches most of the memory allocated for the mjData arena. This causes an OOM failure on memory-limited testing infrastructure. An 8G allocation is sufficient to catch errors that arise from the use of 32-bit integers to handle sizes. PiperOrigin-RevId: 640504620 Change-Id: Ia1949b04a1428f01e1075e26b421facb3babedb6 --- test/engine/engine_io_test.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/engine/engine_io_test.cc b/test/engine/engine_io_test.cc index 6419c133..fc38adc7 100644 --- a/test/engine/engine_io_test.cc +++ b/test/engine/engine_io_test.cc @@ -701,30 +701,30 @@ TEST_F(EngineIoTest, LargeMemory) { TEST_F(EngineIoTest, VeryLargeMemory) { constexpr char xml[] = R"( - + )"; std::array error; mjModel* model = LoadModelFromString(xml, error.data(), error.size()); if (!model) { - // in some test environments, 64GB is too large + // in some test environments, 8GB is too large EXPECT_THAT(error.data(), HasSubstr("Could not allocate memory")); } else { ASSERT_THAT(model, NotNull()) << "Failed to load model: " << error.data(); mjData* data = mj_makeData(model); ASSERT_THAT(data, NotNull()); - // allocate 63G of mjtNums + // allocate 7G of mjtNums mj_markStack(data); - size_t num = 63000000000 / sizeof(mjtNum); + size_t num = 7516192768ull / sizeof(mjtNum); mjtNum* testNum = mj_stackAllocNum(data, num); testNum[num-1] = 1; mj_freeStack(data); - // allocate 63G of bytes + // allocate 7G of bytes mj_markStack(data); - num = 63000000000; + num = 7516192768ull; char* testByte = (char*) mj_stackAllocByte(data, num, alignof(char)); testByte[num-1] = 1; mj_freeStack(data);