LWN.net Logo

Advertisement

Front, Kernel, Security, Distributions, Development. See your byline here on LWN.net.

Advertise here

Short topics in memory management

Short topics in memory management

Posted Mar 7, 2007 17:47 UTC (Wed) by zlynx (subscriber, #2285)
In reply to: Short topics in memory management by ibukanov
Parent article: Short topics in memory management

Checking offset bounds may look easier than a pointer, but it isn't really. A pointer is nothing but an offset from memory location 0, after all.

if( pointer > mmap_base && pointer < mmap_end ) ...

Using an unsigned int offset instead saves you from checking the lower bound, but you lose that savings again the instant you segment your memory into different uses, like using some for text and some for graphics.


(Log in to post comments)

Short topics in memory management

Posted Mar 8, 2007 23:57 UTC (Thu) by jzbiciak (✭ supporter ✭, #5246) [Link]

"A pointer is nothing but an offset from memory location 0, after all."

Well, these days it is on most architectures...

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds