Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2003 13:34:07 -0800
From:      "Sreekanth" <sreekanth@redlinenetworks.com>
To:        <freebsd-hackers@freebsd.org>
Subject:   Mmap and malloc
Message-ID:  <000001c2fa28$c1cfc490$ae28a8c0@SREELAPTOP>

next in thread | raw e-mail | index | archive | help
Hi,
    I have a situation i am not sure i understand.I am running a 4.6.2
FreeBSD system with a Dual Xeon board with 2GB of Physical memory.I have
a test program which continuoulsy calls mmap(with larger size each time)
till it receives MAP_FAILED return value. I then call malloc(with bigger
memory size each time) continuosly till it fails.Here are my results.

Max mem mapped = 714 MB
Max mem alloc = 308 MB

My MAXDMSIZ is 1200*1024*1024 and KVA_PAGE is 512 (2GB)

If i swap the order in wich mmap and malloc are called, then i get the
following result. Max mem alloc = 1200MB Max mem mapped = 711MB

My questions are as follows
1) Why is the difference between two approaches. ?
2) What exactly is the relationship between mmap malloc and KVA_PAGES.
3) I found that the Maximum mmapped memory = 4GB - KVA_PAGES*PAGE_SIZE
- MAXDSIZ - 134
What is the 134 value..? It is very consistent for me for various values
of KVA_PAGES and MAXDSIZ, so i am ruling it being just a coincidence.

I hope somebody has already seen this kind of behaviour and therefore
can help me out..

Thanks in advance,

Sreekanth
ps: If somebody needs the code i used to generate these results, i would
be more than happy to provide it.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000001c2fa28$c1cfc490$ae28a8c0>