Nicholas Sherlock wrote:
On 19/05/2010 3:58 p.m., Reza Roboubi wrote:
Do you know what it takes to do it? How much work for a newcomer to get
up to speed with gcc? (Maybe this should go to the developer list?)
You would need to write a memory allocator which divides the address
space into 4GB (32-bit pages). Then you could create a new malloc
routine which has an extra argument to allow you to allocate memory from
within a specified 4GB page. That way you can make all of your
allocations for a given data structure lie within the same region.
Since we are trying to _compress_ these structs in the first place
malloc'ing them individually is pointless anyway. We should probably
have some sort of custom (fixed size) allocator.
<SIDE-NOTE>
Quote from git source code: "The standard malloc/free wastes too much
space for objects, [...]"
</SIDE-NOTE>
Really, this whole thing is for people who care about scaling something
specific and don't mind doing sbrk and mmap when they need to. So the
main change is a C language extension (nothing glibc/library related.)
Essentially, you would want a pointer type modifier:
struct list {
struct list short * next;
};
Then you can add the top 32-bits to pointer addresses within your data
structure before you attempt to dereference them.
That's the point: not having to do this manually.
Thanks for the reply.
Reza.
Cheers,
Nicholas Sherlock