From: "Dan Maas" <dmaas@dcine.com>
To: <whitney@math.berkeley.edu>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: Subtle MM bug (really 830MB barrier question)
Date: Tue, 9 Jan 2001 06:47:58 -0500 [thread overview]
Message-ID: <01da01c07a32$03995db0$0701a8c0@morph> (raw)
In-Reply-To: <fa.e9ik37v.1lg8urj@ifi.uio.no> <fa.hifgbev.s1ana8@ifi.uio.no>
> 08048000-08b5c000 r-xp 00000000 03:05 1130923
/tmp/newmagma/magma.exe.dyn
> 08b5c000-08cc9000 rw-p 00b13000 03:05 1130923
/tmp/newmagma/magma.exe.dyn
> 08cc9000-0bd00000 rwxp 00000000 00:00 0
> Now, subsequent to each memory allocation, only the second number in the
> third line changes. It becomes 23a78000, then 3b7f0000, and finally
> 3b808000 (after the failed allocation).
OK it's fairly obvious what's happening here. Your program is using its own
allocator, which relies solely on brk() to obtain more memory. On x86 Linux,
brk()-allocated memory (the heap) begins right above the executable and
grows upward - the increasing number you noted above is the top of the heap,
which grows with every brk(). Problem is, the heap can't keep growing
forever - as you discovered, on x86 Linux the upper bound is just below
0x40000000. That boundary is where shared libraries and other memory-mapped
files start to appear.
Note that there is still plenty (~2GB) of address space left, in the region
between the shared libraries and the top of user address space (just under
0xBFFFFFFF). How do you use that space? You need an allocation scheme based
on mmap'ing /dev/zero. As others pointed out, glibc's allocator does just
that.
Here's your short answer: ask the authors of your program to either 1)
replace their custom allocator with regular malloc() or 2) enhance their
custom allocator to use mmap. (or, buy some 64-bit hardware =)...)
Dan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next parent reply other threads:[~2001-01-09 11:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.e9ik37v.1lg8urj@ifi.uio.no>
[not found] ` <fa.hifgbev.s1ana8@ifi.uio.no>
2001-01-09 11:47 ` Dan Maas [this message]
2001-01-08 23:30 Subtle MM bug Andrea Arcangeli
2001-01-09 3:01 ` Subtle MM bug (really 830MB barrier question) Wayne Whitney
2001-01-09 20:06 ` Szabolcs Szakacsits
2001-01-09 23:45 ` Wayne Whitney
2001-01-11 0:03 ` Wayne Whitney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='01da01c07a32$03995db0$0701a8c0@morph' \
--to=dmaas@dcine.com \
--cc=linux-kernel@vger.kernel.org \
--cc=whitney@math.berkeley.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox