{"record":{"id":"7dd53b3b8609939a","repo":"apache/hadoop","slug":"failed-to-allocate-memory-for-stopwatch","errorCode":null,"errorMessage":"failed to allocate memory for stopwatch\n","messagePattern":"failed to allocate memory for stopwatch\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c","lineNumber":87,"sourceCode":"    t *= tb.numer;\n    t /= tb.denom;\n    ts->tv_sec = t / 1000000000ULL;\n    ts->tv_nsec = t - (ts->tv_sec * 1000000000ULL);\n    return 0;\n}\n#else\nstatic int clock_gettime_mono(struct timespec * ts) {\n    return clock_gettime(CLOCK_MONOTONIC, ts);\n}\n#endif\n\nstatic struct stopwatch *stopwatch_create(void)\n{\n    struct stopwatch *watch;\n\n    watch = calloc(1, sizeof(struct stopwatch));\n    if (!watch) {\n        fprintf(stderr, \"failed to allocate memory for stopwatch\\n\");\n        goto error;\n    }\n    if (clock_gettime_mono(&watch->start)) {\n        int err = errno;\n        fprintf(stderr, \"clock_gettime(CLOCK_MONOTONIC) failed with \"\n            \"error %d (%s)\\n\", err, strerror(err));\n        goto error;\n    }\n    return watch;\n\nerror:\n    free(watch);\n    return NULL;\n}\n\nstatic void stopwatch_stop(struct stopwatch *watch,\n        long long bytes_read)\n{","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c#L69-L105","documentation":"Error \"failed to allocate memory for stopwatch\n\" thrown in apache/hadoop.","triggerScenarios":"Allocation of the stopwatch structure failed in vecsum setup.","commonSituations":"Extremely low available memory when launching the vecsum benchmark binary.","solutions":["Free memory or run vecsum on a host with sufficient RAM; the stopwatch struct is tiny, so this indicates severe memory pressure.","Check for earlier leaks in the process that consumed available memory."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}