lightning
[Top][All Lists]
Advanced

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

[Lightning] Memory Allocation on Mac OS X


From: Noah Lavine
Subject: [Lightning] Memory Allocation on Mac OS X
Date: Sun, 26 Sep 2010 17:53:57 -0400

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.

You'll probably notice that the test has a lot of spaghetti code. That
is because I converted the tests one by one and wasn't really thinking
about code reuse. If you think it would be useful, though, I could
collect the code for allocating executable memory into one function
and put that somewhere. It might even be a good thing to add to
Lightning itself, because presumably everyone who uses Lightning will
need to allocate executable memory.

I hope this is helpful
Noah Lavine

Attachment: 0001-Allocate-Executable-Memory.patch
Description: Binary data


reply via email to

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