Re: pthreads and memory allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That makes sense. Also interesting is the fact that creating a non-detached thread causes an 8 Meg stack:

40061000     8188K rwxp 00001000 00:00  [ anon ]

Where is the decision of the stack size made? In the linuxthreads library or in the kernel? I have yet to find that code in the kernel
and do not understand why an 8 Meg stack would be created when using non-detached threads.


Thanks,

Anton



patrick mcmanus wrote:

On Fri, 2004-08-27 at 17:10, anton wilson wrote:


in OUTPUT1. When pthread_create is used, several unexplained memory

[..]


one is 4k (non-writable) and the other is 2044K (both mapped to the zero


I don't recall what all of the allocations are for, but the 2MB is the stack for your new thread. See pthread_attr_setstackaddr() and pthread_attr_setstacksize() for controlling it a bit.

-Pat



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/







--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux