Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.system > #266
| From | Xavier Roche <xroche@free.fr.NOSPAM.invalid> |
|---|---|
| Newsgroups | comp.os.linux.development.system, comp.unix.programmer |
| Subject | Re: [Linux] malloc: small size - small pointer? |
| Date | 2011-09-13 10:23 +0200 |
| Organization | Nowhere Corp. |
| Message-ID | <j4n3t5$rs6$18@news.httrack.net> (permalink) |
| References | <c36c7bc2-537d-4f24-976f-c08d61e06bb6@w12g2000yqa.googlegroups.com> |
Cross-posted to 2 groups.
On 09/13/2011 10:17 AM, Alex Vinokur wrote: > malloc() returns "small" pointers for small sizes. > Any suugestions for such behavior of the malloc function. > Are "small" pointers on heap? From the Linux glibc man page: "Normally, malloc() allocates memory from the heap, and adjusts the size of the heap as required, using sbrk(2). When allocating blocks of memory larger than MMAP_THRESHOLD bytes, the glibc malloc() implementation allocates the memory as a private anonymous mapping using mmap(2). MMAP_THRESHOLD is 128 kB by default, but is adjustable using mallopt(3). Allocations performed using mmap(2) are unaffected by the RLIMIT_DATA resource limit (see getrlimit(2))." In your test, malloc switched to mmap after $[0x1ffea] == 131050 == roughly 128KiB.
Back to comp.os.linux.development.system | Previous | Next — Previous in thread | Next in thread | Find similar
[Linux] malloc: small size - small pointer? Alex Vinokur <alex.vinokur@gmail.com> - 2011-09-13 01:17 -0700
Re: [Linux] malloc: small size - small pointer? Xavier Roche <xroche@free.fr.NOSPAM.invalid> - 2011-09-13 10:23 +0200
Re: malloc: small size - small pointer? Alex Vinokur <alex.vinokur@gmail.com> - 2011-09-13 23:21 -0700
Re: malloc: small size - small pointer? Alex Vinokur <alex.vinokur@gmail.com> - 2011-09-13 23:18 -0700
Re: malloc: small size - small pointer? Alex Vinokur <alex.vinokur@gmail.com> - 2011-09-14 00:08 -0700
Re: [Linux] malloc: small size - small pointer? Kaz Kylheku <kaz@kylheku.com> - 2011-12-24 06:56 +0000
csiph-web