NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: jemalloc SEGV problem



Hi,
mmap does not fail.
mamap does allocate memory for the variable "chunk"

and then when the program tries to modify "chunk"  SEGV is recieved.

I checked the problem is below:
The variable
'pagesize_2pow' is calculated as

                result = sysconf(_SC_PAGESIZE);
                assert(result != -1);
                pagesize = (unsigned) result;

                /*
                 * We assume that pagesize is a power of 2 when calculating
                 * pagesize_mask and pagesize_2pow.
                 */
                assert(((result - 1) & result) == 0);
                pagesize_mask = result - 1;
                pagesize_2pow = ffs((int)result) - 1;

In my case case pagesize_2pow comes as 11.

Since sysconf(_SC_PAGESIZE) returns 4096.

If i retain the macro value CHUNK_2POW_DEFAULT as 20 and initialize
  pagesize_2pow = 19
 which means my pagesize is 2^20..

jemalloc() works fine , does not give any SEGV.

In anycase mamp () is not failing.
I feel the problem is with the alignment of the memory which is not happening
properly..
Also i checked none of the variables are overflowing.

Thanks & Regards,
Channa




2008/11/17 Christos Zoulas <christos%zoulas.com@localhost>:
> On Nov 17, 12:42pm, channa.kad%gmail.com@localhost (Channa) wrote:
> -- Subject: Re: jemalloc SEGV problem
>
> | Hi,
> | Ya i understand but when i changed the pagesize to 64K in mips arch
> |  and retained the macro CHUNK_2POW_DEFAULT as present in jemalloc.c
> | original file.I dint get any seg fault.
> |
> | But when i changed the pagesize again to 4K i got SEGV.
> |
> | Regards,
> | Channa
>
> What does the ktrace of your program show? Does the mmap fail?
>
> christos
>


Home | Main Index | Thread Index | Old Index