Hans-Peter Reichert
|
AW: pthread_create API failing with EAGAIN
|
Hans-Peter Reichert
06/10/2010 7:18 AM
post56496
|
AW: pthread_create API failing with EAGAIN
Not all of the in total available 32MB per process address space is usable for all kind of mappings.
Referring to the 6.4.1 documentation http://www.qnx.com/developers/docs/6.4.1/neutrino/prog/arm_memory.html
you see that the 32MB are diveded into different regions
used for different kind of mapping types.
6.3.0 documenation does not show this, but I am sure that this kind of separation is also done in 6.3.0
HTH
/hp
<snippet>
This mechanism imposes a number of restrictions:
* Each process address space is limited to 32 MB in size. This space contains all the code, data, heap, thread
stacks and shared objects mapped by the process. The virtual address space is allocated as follows:
Range: Used for:
0- 1 MB Initial thread stack
1-16 MB Program text, data, and BSS
16-24 MB Shared libraries
24-32 MB MAP_SHARED mappings
When a program is loaded, the loader will have populated the stack, text, data, BSS, and shared library areas.
If you allocate memory, malloc() tries to find a free virtual address range for the requested size. If you try to
allocate more than 15 MB, the allocation will likely fail because of this layout. The free areas are typically:
o approximately 15 MB (addresses between 1 MB + sizeof(text/data/heap) and the 16 MB boundary)
o approximately 7 MB (addresses between 16 MB + sizeof(shared libs) and the 24 MB boundary)
o approximately 8 MB (addresses between 24 MB + sizeof(MAP_SHARED mappings) and the 32 MB boundary)
</snippet>
>-----Ursprüngliche Nachricht-----
>Von: Christian Scheuch [mailto:community-noreply@qnx.com]
>Gesendet: Donnerstag, 10. Juni 2010 09:27
>An: ostech-core_os
>Betreff: pthread_create API failing with EAGAIN
>
>I have a process that is able to create only 41 Threads.
>Attempt to create any other thread results in failure with
>eror code EAGAIN.
>
>To the best of my knowledge ( there could be exceptions I am
>not aware of ) all threads are created dettached.
>
>The problem is immediately reproducible as soon as the process
>comes up. So I am not suspecting any memory leak .
>
>The number of threads that can be created reduces as the code
>size of the process increases.
>
>The process has 10 MB of code size 3.6 MB of data and 47
>threads amounting to 132K each (6.2 Mb). This adds of to approx 20 MB.
>
>The process is running on ARM 7. QNX version 6.3.0. The
>virtual address space for a process is restricted to 32 M. So
>I assume that I have 12 MB approx of virtual address space available.
>
>What could be the reason that I am unable to create more
>threads, even though I have 12 MB of virtual address space remaining?
>
>I am attaching the pidin mem dump of the process here
>
>
>
>_______________________________________________
>
>OSTech
>http://community.qnx.com/sf/go/post56485
>
|
|
|