Skip to content

Commit

Permalink
Check for malloc_trim() support.
Browse files Browse the repository at this point in the history
Add preprocessor directives to check if glibc is used in the system (default in the reference system), since malloc_trim() is not available in other system, like Alpine which uses musl libc
  • Loading branch information
jjnicola authored and Kraemii committed Mar 16, 2022
1 parent 30915be commit a1e405f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pluginscheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ plugins_scheduler_init (const char *plugins_list, int autoload, int *error)
plugins_scheduler_free (ret);
return NULL;
}

#ifdef __GLIBC__
malloc_trim (0);
#endif
return ret;
}

Expand Down Expand Up @@ -427,7 +430,9 @@ scheduler_phase_cleanup (plugins_scheduler_t sched, int start, int end)
element = element->next;
}
}
#ifdef __GLIBC__
malloc_trim (0);
#endif
}

struct scheduler_plugin *
Expand Down

0 comments on commit a1e405f

Please sign in to comment.