[Top][All Lists]

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

Re: [Lightning] Memory Allocation on Mac OS X

From: Paolo Bonzini
Subject: Re: [Lightning] Memory Allocation on Mac OS X
Date: Mon, 27 Sep 2010 11:32:53 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3

On 09/27/2010 01:29 AM, Paulo César Pereira de Andrade wrote:
2010/9/26 Noah Lavine<address@hidden>:
Hello Lightning developers,

The attached patch fixes an issue with memory allocation on Mac OS X.
The trouble was that the test programs allocate memory for their
functions as static variables, but in Mac OS X statically allocated
memory is not marked as executable. This patch uses posix_memalign and
mprotect instead, which brings the number of failed tests on my
machine from 21 to 2.

   I think most tests are somewhat bogus, and the way jit_flush_code()
works, and calls mprotect() is wrong, as it needs to adjust it to unaligned
memory, what means marking random, but on the same process, memory
as executable.

As you suggest using mmap to allocate memory will do. Alternatively you can use posix_memalign with the page-size as the alignment.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]