#fixed code
                                @Override
    public void run() {
        final SingleWriterRecorder recorder =
                new SingleWriterRecorder(
                        config.lowestTrackableValue,
                        config.highestTrackableValue,
                        config.numberOfSignificantValueDigits
                );

        Histogram intervalHistogram = null;

        HiccupRecorder hiccupRecorder;

        final long uptimeAtInitialStartTime = ManagementFactory.getRuntimeMXBean().getUptime();
        long now = System.currentTimeMillis();
        long jvmStartTime = now - uptimeAtInitialStartTime;
        long reportingStartTime = jvmStartTime;

        if (config.inputFileName == null) {
            // Normal operating mode.
            // Launch a hiccup recorder, a process termination monitor, and an optional control process:
            hiccupRecorder = this.createHiccupRecorder(recorder);
            if (config.terminateWithStdInput) {
                new TerminateWithStdInputReader();
            }
            if (config.controlProcessCommand != null) {
                new ExecProcess(config.controlProcessCommand, "ControlProcess", log, config.verbose);
            }
        } else {
            // Take input from file instead of sampling it ourselves.
            // Launch an input hiccup recorder, but no termination monitoring or control process:
            hiccupRecorder = new InputRecorder(recorder, config.inputFileName);
        }

        histogramLogWriter.outputComment("[Logged with " + getVersionString() + "]");
        histogramLogWriter.outputLogFormatVersion();

        try {
            final long startTime;

            if (config.inputFileName == null) {
                // Normal operating mode:
                if (config.startDelayMs > 0) {
                    // Run hiccup recorder during startDelayMs time to let code warm up:
                    hiccupRecorder.start();
                    while (config.startDelayMs > System.currentTimeMillis() - jvmStartTime) {
                        Thread.sleep(100);
                    }
                    hiccupRecorder.terminate();
                    hiccupRecorder.join();

                    recorder.reset();
                    hiccupRecorder = new HiccupRecorder(recorder, config.allocateObjects);
                }
                hiccupRecorder.start();
                startTime = System.currentTimeMillis();
                if (config.startTimeAtZero) {
                    reportingStartTime = startTime;
                }

                histogramLogWriter.outputStartTime(reportingStartTime);
                histogramLogWriter.setBaseTime(reportingStartTime);

            } else {
                // Reading from input file, not sampling ourselves...:
                hiccupRecorder.start();
                reportingStartTime = startTime = hiccupRecorder.getCurrentTimeMsecWithDelay(0);

                histogramLogWriter.outputComment("[Data read from input file \"" + config.inputFileName + "\" at " + new Date() + "]");
            }

            histogramLogWriter.outputLegend();

            long nextReportingTime = startTime + config.reportingIntervalMs;
            long intervalStartTimeMsec = 0;

            while ((now > 0) && ((config.runTimeMs == 0) || (config.runTimeMs > now - startTime))) {
                now = hiccupRecorder.getCurrentTimeMsecWithDelay(nextReportingTime); // could return -1 to indicate termination
                if (now > nextReportingTime) {
                    // Get the latest interval histogram and give the recorder a fresh Histogram for the next interval
                    intervalHistogram = recorder.getIntervalHistogram(intervalHistogram);

                    while (now > nextReportingTime) {
                        nextReportingTime += config.reportingIntervalMs;
                    }

                    if (config.inputFileName != null) {
                        // When read from input file, use timestamps from file input for start/end of log intervals:
                        intervalHistogram.setStartTimeStamp(intervalStartTimeMsec);
                        intervalHistogram.setEndTimeStamp(now);
                        intervalStartTimeMsec = now;
                    }

                    if (intervalHistogram.getTotalCount() > 0) {
                        histogramLogWriter.outputIntervalHistogram(intervalHistogram);
                    }
                }
            }
        } catch (InterruptedException e) {
            if (config.verbose) {
                log.println("# HiccupMeter terminating...");
            }
        }

        try {
            hiccupRecorder.terminate();
            hiccupRecorder.join();
        } catch (InterruptedException e) {
            if (config.verbose) {
                log.println("# HiccupMeter terminate/join interrupted");
            }
        }
    }
#vulnerable code 
                                @Override
    public void run() {
        final SingleWriterRecorder recorder =
                new SingleWriterRecorder(
                        config.lowestTrackableValue,
                        config.highestTrackableValue,
                        config.numberOfSignificantValueDigits
                );

        Histogram intervalHistogram = null;

        HiccupRecorder hiccupRecorder;

        final long uptimeAtInitialStartTime = ManagementFactory.getRuntimeMXBean().getUptime();
        long now = System.currentTimeMillis();
        long jvmStartTime = now - uptimeAtInitialStartTime;
        long reportingStartTime = jvmStartTime;

        if (config.inputFileName == null) {
            // Normal operating mode.
            // Launch a hiccup recorder, a process termination monitor, and an optional control process:
            hiccupRecorder = this.createHiccupRecorder(recorder);
            if (config.terminateWithStdInput) {
                new TerminateWithStdInputReader();
            }
            if (config.controlProcessCommand != null) {
                new ExecProcess(config.controlProcessCommand, "ControlProcess", log, config.verbose);
            }
        } else {
            // Take input from file instead of sampling it ourselves.
            // Launch an input hiccup recorder, but no termination monitoring or control process:
            hiccupRecorder = new InputRecorder(recorder, config.inputFileName);
        }

        histogramLogWriter.outputComment("[Logged with " + getVersionString() + "]");
        histogramLogWriter.outputLogFormatVersion();

        try {
            final long startTime;

            if (config.inputFileName == null) {
                // Normal operating mode:
                if (config.startDelayMs > 0) {
                    // Run hiccup recorder during startDelayMs time to let code warm up:
                    hiccupRecorder.start();
                    while (config.startDelayMs > System.currentTimeMillis() - jvmStartTime) {
                        Thread.sleep(100);
                    }
                    hiccupRecorder.terminate();
                    hiccupRecorder.join();

                    recorder.reset();
                    hiccupRecorder = new HiccupRecorder(recorder, config.allocateObjects);
                }
                hiccupRecorder.start();
                startTime = System.currentTimeMillis();
                if (config.startTimeAtZero) {
                    reportingStartTime = startTime;
                }

                histogramLogWriter.outputStartTime(reportingStartTime);
                histogramLogWriter.setBaseTime(reportingStartTime);

            } else {
                // Reading from input file, not sampling ourselves...:
                hiccupRecorder.start();
                reportingStartTime = startTime = hiccupRecorder.getCurrentTimeMsecWithDelay(0);

                histogramLogWriter.outputComment("[Data read from input file \"" + config.inputFileName + "\" at " + new Date() + "]");
            }

            histogramLogWriter.outputLegend();

            long nextReportingTime = startTime + config.reportingIntervalMs;

            while ((now > 0) && ((config.runTimeMs == 0) || (config.runTimeMs > now - startTime))) {
                now = hiccupRecorder.getCurrentTimeMsecWithDelay(nextReportingTime); // could return -1 to indicate termination
                if (now > nextReportingTime) {
                    // Get the latest interval histogram and give the recorder a fresh Histogram for the next interval
                    intervalHistogram = recorder.getIntervalHistogram(intervalHistogram);

                    while (now > nextReportingTime) {
                        nextReportingTime += config.reportingIntervalMs;
                    }

                    if (intervalHistogram.getTotalCount() > 0) {
                        histogramLogWriter.outputIntervalHistogram(intervalHistogram);
                    }
                }
            }
        } catch (InterruptedException e) {
            if (config.verbose) {
                log.println("# HiccupMeter terminating...");
            }
        }

        try {
            hiccupRecorder.terminate();
            hiccupRecorder.join();
        } catch (InterruptedException e) {
            if (config.verbose) {
                log.println("# HiccupMeter terminate/join interrupted");
            }
        }
    } 
                            #location 50 
                            #vulnerability type RESOURCE_LEAK