<commit_before>
#include <xcopy.h>
#include <gryphon.h>


/* check resource usage, such as memory usage and cpu usage */
static void
check_resource_usage(tc_event_timer_t *evt)
{
    int           ret, who;
    struct rusage usage;

    who = RUSAGE_SELF;

    ret = getrusage(who, &usage);
    if (ret == -1) {
        tc_log_info(LOG_ERR, errno, "getrusage");
    }

    /* total amount of user time used */
    tc_log_info(LOG_NOTICE, 0, "user time used:%ld", usage.ru_utime.tv_sec);

    /* total amount of system time used */
    tc_log_info(LOG_NOTICE, 0, "sys  time used:%ld", usage.ru_stime.tv_sec);

    /* maximum resident set size (in kilobytes) */
    /* only valid since Linux 2.6.32 */
    tc_log_info(LOG_NOTICE, 0, "max memory size:%ld", usage.ru_maxrss);

    evt->msec = tc_current_time_msec + 60000;
}

void
gryphon_release_resources()
{
    int i;

    tc_log_info(LOG_WARN, 0, "sig %d received", tc_over); 

    output_stat(); 


    tc_time_remove_timer();
    tc_log_info(LOG_NOTICE, 0, "remove timer over");

    release_user_resources();

    tc_event_loop_finish(&event_loop);
    tc_log_info(LOG_NOTICE, 0, "tc_event_loop_finish over");

    tc_log_end();


    if (tc_raw_socket_out > 0) {
        close(tc_raw_socket_out);
        tc_raw_socket_out = -1;
    }

#if (GRYPHON_PCAP_SEND)
    tc_pcap_over();
#endif

    if (clt_settings.transfer.mappings != NULL) {

        for (i = 0; i < clt_settings.transfer.num; i++) {
            free(clt_settings.transfer.mappings[i]);
        }

        free(clt_settings.transfer.mappings);
        clt_settings.transfer.mappings = NULL;
    }
}<commit_msg>Release mem pool<commit_after>
#include <xcopy.h>
#include <gryphon.h>


/* check resource usage, such as memory usage and cpu usage */
static void
check_resource_usage(tc_event_timer_t *evt)
{
    int           ret, who;
    struct rusage usage;

    who = RUSAGE_SELF;

    ret = getrusage(who, &usage);
    if (ret == -1) {
        tc_log_info(LOG_ERR, errno, "getrusage");
    }

    /* total amount of user time used */
    tc_log_info(LOG_NOTICE, 0, "user time used:%ld", usage.ru_utime.tv_sec);

    /* total amount of system time used */
    tc_log_info(LOG_NOTICE, 0, "sys  time used:%ld", usage.ru_stime.tv_sec);

    /* maximum resident set size (in kilobytes) */
    /* only valid since Linux 2.6.32 */
    tc_log_info(LOG_NOTICE, 0, "max memory size:%ld", usage.ru_maxrss);

    evt->msec = tc_current_time_msec + 60000;
}

void
gryphon_release_resources()
{
    int i;

    tc_log_info(LOG_WARN, 0, "sig %d received", tc_over); 

    output_stat(); 


    tc_time_remove_timer();
    tc_log_info(LOG_NOTICE, 0, "remove timer over");

    release_user_resources();

    tc_event_loop_finish(&event_loop);
    tc_log_info(LOG_NOTICE, 0, "tc_event_loop_finish over");

    tc_log_end();


    if (tc_raw_socket_out > 0) {
        close(tc_raw_socket_out);
        tc_raw_socket_out = -1;
    }

#if (GRYPHON_PCAP_SEND)
    tc_pcap_over();
#endif

    if (clt_settings.transfer.mappings != NULL) {

        for (i = 0; i < clt_settings.transfer.num; i++) {
            free(clt_settings.transfer.mappings[i]);
        }

        free(clt_settings.transfer.mappings);
        clt_settings.transfer.mappings = NULL;
    }

    if (clt_settings.mem_pool != NULL) {
        free(clt_settings.mem_pool);
        clt_settings.mem_pool = NULL;
    }
}
{'fraction_non_alphanumeric': 0.12477823772915435, 'fraction_numerical': 0.011235955056179775, 'mean_word_length': 2.966002344665885, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2066547', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1246, 'n_words': 262}