Re: page sizes




"Phlip" <phlip2005@xxxxxxxxx> schrieb im Newsbeitrag
news:4800038f$0$25921$4c368faf@xxxxxxxxxxxxxxxxx
copx wrote:

Do memory managers usually use page sizes which are a power of two or
not?

Yes. This optimizes the variables and hardware registers used to manage
the pages. None of their bits are wasted. User-level code doesn't need
these optimizations, so they pick array sizes with different conveniences.

"Doesn't need" is your opinion.

Which page size can one expect on Windows/i386 and Linux/i386?

Usually 4096 bytes.

Thanks!

But what will you do with the answer

I am trying to squeeze a few more nanoseconds out of a programming language
interpreter. The documentation of malloc() on one of the platforms I am
targetting explicitly gives the advice to allocate powers of 2 to improve
performance. However, that is only true if the allocated blocks are <=
pagesize. Larger blocks allocate fastest if they are multiples of the page
size.

- it might vary for any conceivable reason, including odd bus
architectures.

Not on Redhad Linux x86/32. The official documentation specifies the page
size as 4096. I guess one could easily hack the system to set another size,
but one can assume that 99,9% of all users won't do this.



.