I am programming something in C that creates a lot of Pthreads in Linux on a 256Mb system. I usually have +200Mb free.
When I run the program with a low amount of thread
Why stacksize = (double) 16*1024; ? It is integer.
stacksize = (double) 16*1024;
Try to set it to 32 or 64 kilobytes, because 16*1024 may be not allowed; there can be also TLS in the stack (even you doesn't use TLS; libraries do, including libc).
So, change the line to
stacksize = 64*1024;
and check how much memory is consumed.