Re: strange stack limit behavior when allocating more than 2GB mem on 32bit machine

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


Joe wrote:

> Clear. But how comes 2000MB can be allocated when stack limit is unlimited?

Because malloc() can allocate from the area reserved for the stack. 
The stack limit is a limit, not a reservation.

If you set a small stack limit, there will be ~2.7 GiB below where the
libraries are mapped and very little above it. If you set the stack
limit to "unlimited", there will be ~850 MiB below where the libraries
are mapped and ~2 GiB above it.

malloc() can allocate from either of those areas, but any particular
allocation must fit into one or the other. It can't split a single
allocation between areas, and it can't move any existing mappings.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

Add to Google Powered by Linux