Skip to content

Commit e9a94e7

Browse files
authored
Change: Check for malloc_trim() support. (#668)
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
1 parent 4bf399b commit e9a94e7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

base/hosts.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,9 @@ gvm_hosts_deduplicate (gvm_hosts_t *hosts)
10931093
hosts->count -= duplicates;
10941094
hosts->duplicated += duplicates;
10951095
hosts->current = 0;
1096+
#ifdef __GLIBC__
10961097
malloc_trim (0);
1098+
#endif
10971099
}
10981100

10991101
/**
@@ -1288,7 +1290,9 @@ gvm_hosts_new_with_max (const gchar *hosts_str, unsigned int max_hosts)
12881290
gvm_hosts_deduplicate (hosts);
12891291

12901292
g_strfreev (split);
1293+
#ifdef __GLIBC__
12911294
malloc_trim (0);
1295+
#endif
12921296
return hosts;
12931297
}
12941298

0 commit comments

Comments
 (0)