2 /* Test for aspacem bug reported by Alex Bennee, reported on users
3 list around 9 Aug 06, resulting in
5 > > --1515:0:aspacem Valgrind: FATAL: aspacem assertion failed:
6 > > --1515:0:aspacem holeEnd <= aspacem_maxAddr
7 > > --1515:0:aspacem at m_aspacemgr/aspacemgr.c:1998
8 > > (vgPlain_am_get_advisory)
9 > > --1515:0:aspacem Exiting now.
13 > I think the problem here is that you've done an mmap (either fixed or
14 > hinted) above aspacem_maxAddr and then munmaped it which leaves you
15 > with a free segment above aspacem_maxAddr.
17 The sequence seems to be that you have to allocate memory somewhere
18 above aspacem_maxAddr, then free it, then do another hinted
19 allocation that is above aspacem_maxAddr but which can't be done
20 due to the memory already being in use. This program will reproduce
23 On investigation: the problem was the munmap returns its space in
24 the form of SkFree even though the space above aspacem_maxAddr is
25 supposed to be SkResvn. This is now fixed.
30 #include "tests/sys_mman.h"
32 int main(int argc
, char **argv
)
35 if ((p
= mmap((void*)0x1F7F100000, 4096, PROT_READ
|PROT_WRITE
,
36 MAP_PRIVATE
|MAP_FIXED
|MAP_ANONYMOUS
, -1, 0)) == (void *)-1)
41 if (munmap(p
, 4096) < 0)
46 if ((p
= mmap((void*)0x1F7F101000, 4096, PROT_READ
,
47 MAP_PRIVATE
|MAP_ANONYMOUS
, -1, 0)) == (void *)-1)
52 if ((p
= mmap((void*)0x1F7F101000, 4096, PROT_READ
,
53 MAP_PRIVATE
|MAP_ANONYMOUS
, -1, 0)) == (void *)-1)
59 printf("made it through alive!\n");