{"record":{"id":"9c51418dd9755c62","repo":"openjdk/jdk","slug":"error-out-of-memory-in-adlc-n","errorCode":null,"errorMessage":"Error: Out of memory in ADLC\\n","messagePattern":"Error: Out of memory in ADLC\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/hotspot/share/adlc/adlArena.cpp","lineNumber":30,"sourceCode":" * version 2 for more details (a copy is included in the LICENSE file that\n * accompanied this code).\n *\n * You should have received a copy of the GNU General Public License version\n * 2 along with this work; if not, write to the Free Software Foundation,\n * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n *\n * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n * or visit www.oracle.com if you need additional information or have any\n * questions.\n *\n */\n\n#include \"adlc.hpp\"\n\nvoid* AdlAllocateHeap(size_t size) {\n  unsigned char* ptr = (unsigned char*) malloc(size);\n  if (ptr == nullptr && size != 0) {\n    fprintf(stderr, \"Error: Out of memory in ADLC\\n\"); // logging can cause crash!\n    fflush(stderr);\n    exit(1);\n  }\n  return ptr;\n}\n\nvoid* AdlReAllocateHeap(void* old_ptr, size_t size) {\n  unsigned char* ptr = (unsigned char*) realloc(old_ptr, size);\n  if (ptr == nullptr && size != 0) {\n    fprintf(stderr, \"Error: Out of memory in ADLC\\n\"); // logging can cause crash!\n    fflush(stderr);\n    exit(1);\n  }\n  return ptr;\n}\n\nvoid* AdlChunk::operator new(size_t requested_size, size_t length) throw() {\n  assert(requested_size <= SIZE_MAX - length, \"overflow\");","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/hotspot/share/adlc/adlArena.cpp#L12-L48","documentation":"ADLC (the HotSpot Architecture Description Language compiler, built and run during the JDK build to generate match tables from .ad files) failed its heap allocation in AdlAllocateHeap: malloc() returned NULL for a non-zero size. The tool prints 'Error: Out of memory in ADLC' to stderr and immediately exits with status 1, aborting the JVM build.","triggerScenarios":"AdlAllocateHeap(size) is the single allocation entry point for all ADLC arenas/chunks (AdlChunk::operator new routes here). It fails when the process cannot get more memory — huge .ad platform description files, arena growth during phase-2 DFA generation, or a constrained build environment (ulimit -v, container memory cap, out of swap).","commonSituations":"Building the JDK inside a Docker/CI container with a low memory limit; ulimit -v set for the build shell; very large architectural changes to a cpu .ad file that blow up MatchList/DFA memory; parallel make jobs (HIGH_MEM make targets like adlc) exhausting RAM.","solutions":["Free memory or raise the container/VM memory limit, then rerun make","Check 'ulimit -v' and 'ulimit -m' in the build shell; raise or unset virtual memory limits","Reduce parallelism of the build (JOBS=... / make -j) so adlc is not competing for RAM","If it reproduces deterministically on a specific .ad change, bisect the .ad edit — an accidental exponential MatchRule expansion may be the real cause"],"exampleFix":"# before\nulimit -v 2097152  # 2GB virtual cap -> adlc OOM\nmake images\n\n# after\nulimit -v unlimited\nmake images","handlingStrategy":"validation","validationCode":"# run before the build\nfree_mem=$(awk '/MemAvailable/{print int($2/1024)}' /proc/meminfo)\nvlimit=$(ulimit -v); [ \"$vlimit\" != \"unlimited\" ] && [ \"$vlimit\" -lt 4194304 ] && echo \"raise ulimit -v\" && exit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provision >=2-4 GB RAM for the adlc step in CI containers","Remove or raise 'ulimit -v' in build shells","Limit make -j when memory is tight","Watch deterministic OOM on one .ad change: it signals an exponential rule, not an environment issue"],"tags":["adlc","build","hotspot","out-of-memory","native"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}