What's the problem 'Compilation failed: std::bad_alloc'

2026-08-07 04:08:33,690 - INFO - parser.py:288 - Translation completed on ONNX model yolo26s (completion time: 00:00:01.93)
2026-08-07 04:08:35,543 - INFO - client_runner.py:1831 - Saved HAR to: /source/results/yolo26s/yolo26s/yolo26s_hailo_model.har
2026-08-07 04:08:36,982 - INFO - client_runner.py:476 - Loading model script commands to yolo26s from ./cfg/script/yolo26s.alls
2026-08-07 04:08:38,334 - IMPORTANT - sdk_backend.py:1009 - Starting Model Optimization
2026-08-07 04:27:52,050 - IMPORTANT - sdk_backend.py:1050 - Model Optimization is done
2026-08-07 04:27:53,408 - INFO - client_runner.py:1831 - Saved HAR to: /source/results/yolo26s/yolo26s/yolo26s_quantized_model.har
2026-08-07 04:28:02,704 - INFO - hailo_tools_runner.py:507 - To achieve optimal performance, set the compiler_optimization_level to “max” by adding performance_param(compiler_optimization_level=max) to the model script. Note that this may increase compilation time.
2026-08-07 04:28:03,348 - ERROR - hailo_tools_runner.py:579 - Failed to produce compiled graph
2026-08-07 04:28:03,357 - ERROR - hailo_tools_runner.py:231 - BackendAllocatorException: Compilation failed: std::bad_alloc

I have currently performed optimization as normal, but during the compile process, a std::bad_alloc occurs at the starting hailo allocation and compilation flow, causing the compilation to fail. What could be the reason.

Comment) I’m working on a high-performance server grade PC.

  1. Insufficient system RAM — Even on a high-performance server, the Hailo compiler can be very memory-intensive during the allocation phase, especially for larger models. The compilation process (particularly at higher optimization levels) exhausts searches over resource utilization, which can require significant memory.

  2. Compiler optimization level — The log suggests you haven’t explicitly set compiler_optimization_level. The default is level 1. Using compiler_optimization_level=max (as suggested in the log) will require even more memory, but you could also try level 0 to reduce memory pressure:

    • 0 — returns the first feasible solution found (least resource-intensive)

    • 1 — returns the best solution under default utilization (default)

    • 2 or max — exhausts searches over best utilization (most resource-intensive)