Listing 1. Setting the Trim Threshold with mallopt() #include #include int main(int argc, char **argv) { int thr; char *p1; if (argc != 2) { printf("Usage: Listing_1 \n"); exit(0); } thr = atoi(argv[1])*1024; if (!mallopt(M_TRIM_THRESHOLD, thr)) { printf("mallopt() failed\n"); } printf("Allocating 100k, trim threshhold is " "set to %d bytes\n", thr); p1 = malloc(100000); malloc_stats(); printf("\nNow freeing 100k\n"); free(p1); malloc_stats(); }