On Mon, Feb 17, 2003 at 02:09:07AM +0000, Bryan K. wrote: > Why isn't there any system call that tells a program if a virtual memory > region is valid or not? I suspect that the answer to this is that it would > lead to poorly written programs. Am I correct? The answer is that programs do their memory bookkeeping themselves, so there is no need for it. Your program has to keep track of all malloc()'ed memory areas, the memory allocator behind malloc() keeps track of the memory it got from the kernel. Even if there is such a call, it is not going to help you. The granularity would be in pages (usually 4k), and only the program itself knows what's in those pages, so we're back at the bookkeeping issue. To get an idea: do 'cat /proc/self/maps' and try to figure out where the program heap is. Erik -- J.A.K. (Erik) Mouw Email: J.A.K.Mouw@its.tudelft.nl mouw@nl.linux.org
Attachment:
pgp00312.pgp
Description: PGP signature