Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Nov 2011 21:38:19 +0400 (MSK)
From:      Maxim Konovalov <maxim@freebsd.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        arch@freebsd.org, current@freebsd.org, igor@sysoev.ru, Maxim Dounin <mdounin@mdounin.ru>
Subject:   Re: RLIMIT_DATA and malloc(3) use of mmap(2)
Message-ID:  <alpine.BSF.2.00.1111242056080.69998@mp2.macomnet.net>
In-Reply-To: <alpine.BSF.2.00.1111231121260.69998@mp2.macomnet.net>
References:  <20111122124410.GP50300@deviant.kiev.zoral.com.ua> <20111122154357.GI95664@mdounin.ru> <20111122154935.GR50300@deviant.kiev.zoral.com.ua> <alpine.BSF.2.00.1111231121260.69998@mp2.macomnet.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Kostik,

On Wed, 23 Nov 2011, 11:22+0400, Maxim Konovalov wrote:

> [...]
> > Anyway, the patch needs testers before I will push it forward.
> >
> [igor's email was corrected]
>
> We will test it in out environment and let you know.
>
It seems I don't understand how it works.

Here is a test program: http://maxim.int.ru/stuff/malloc_test.c.txt

It allocates successfully 64x1MB chunks by malloc(), reallocf() and
realloc() with the following command line:

MALLOC_OPTIONS=JM limits -d 10m ./malloc_test

When we add L flag to the MALLOC_OPTIONS it starts to work strange:

It allocates 64MB via malloc() but fails to allocate more than 3MB by
realloc() and reallocf().

More funny, the result varies from time to time:

$ MALLOC_OPTIONS=JML limits -d 10m ./malloc_test | head
RLIMIT_DATA: rlim_cur is 10485760, rlim_max is 10485760
1th allocation failed
2th allocation failed
3th allocation failed
4th allocation failed
5th allocation failed
6th allocation failed
7th allocation failed
8th allocation failed
9th allocation failed
$ MALLOC_OPTIONS=JML limits -d 10m ./malloc_test | head
RLIMIT_DATA: rlim_cur is 10485760, rlim_max is 10485760
1048576 bytes successfuly allocated
2097152 bytes successfuly allocated
3145728 bytes successfuly allocated
4194304 bytes successfuly allocated
5242880 bytes successfuly allocated
6291456 bytes successfuly allocated
7340032 bytes successfuly allocated
8388608 bytes successfuly allocated
9437184 bytes successfuly allocated
$ MALLOC_OPTIONS=JML limits -d 10m ./malloc_test | head
RLIMIT_DATA: rlim_cur is 10485760, rlim_max is 10485760
1th allocation failed
2th allocation failed
3th allocation failed
4th allocation failed
5th allocation failed
6th allocation failed
7th allocation failed
8th allocation failed
9th allocation failed

It's today -current with your patch.

-- 
Maxim Konovalov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1111242056080.69998>