4 ms·
Definitely not. In rough order of importance: 1. Space for NULL should be big enough for at least a medium-sized structure, otherwise (*NULL)->field = blah wi
by kdunwoody 9y ago
Definitely not. In rough order of importance:
1. Space for NULL should be big enough for at least a medium-sized structure, otherwise (*NULL)->field = blah will overwrite your code.
2. Because of (1), Linux (for example) doesn't even allow processes to map the first page or so of memory.
3. On many platforms the PC needs to be aligned to a word boundary.
- rocky1138 9y agoI see. I've obviously got a lot more to learn. Thanks :) One more question, though: how much space should be safe to leave for NULL? Is 128MB enough? Why not only as much as required? I suppose it doesn't really matter anyway since the entry point location is virtual at this point anyway.
- Ded7xSEoPKYNsDd 9y agoIt's impossible to know how much exactly is required. (While structures are fixed size, arrays indices are not.) Linux allows you to configure the limit at /proc/sys/vm/mmap_min_addr.