1
0
mirror of https://github.com/bol-van/zapret.git synced 2025-03-29 19:36:27 +03:00

tpws: decrease process VSZ by limiting thread stack size

This commit is contained in:
bol-van 2024-04-05 12:17:41 +03:00
parent 72762694df
commit a760745452
12 changed files with 11 additions and 1 deletions
binaries
aarch64
arm
freebsd-x64
mac64
mips32r1-lsb
mips32r1-msb
mips64r2-msb
ppc
x86
x86_64
tpws

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -179,14 +179,24 @@ bool resolver_init(int threads, int fd_signal_pipe)
action.sa_handler = sigbreak;
sigaction(SIG_BREAK, &action, NULL);
pthread_attr_t attr;
if (pthread_attr_init(&attr)) goto ex1;
// set minimum thread stack size
if (pthread_attr_setstacksize(&attr,20480))
{
pthread_attr_destroy(&attr);
goto ex1;
}
for(t=0, resolver.threads=threads ; t<threads ; t++)
{
if (pthread_create(resolver.thread + t, NULL, resolver_thread, NULL))
if (pthread_create(resolver.thread + t, &attr, resolver_thread, NULL))
{
resolver.threads=t;
break;
}
}
pthread_attr_destroy(&attr);
if (!resolver.threads)
{
// could not start any threads