www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/03/05/13:30:46

Date: Fri, 5 Mar 93 10:01:54 -0800
From: thinman AT netcom DOT com (Technically Sweet)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: bug in SUIT?

This reminds me of another thing that would be handy in DJGPP:
virtual memory map control.

The UNIX mmap() system call lets you map a file to a memory
region.  Among other things, this means you can allocate
alternate virtual addresses for your actual RAM.

This would help find malloc() bugs in large
ported applications (the single most prevalent C problem,
I find) by allowing a special malloc() that assigns
unique virtual addresses for each malloc'd chunk.

The trick is to assign a separate virtual page for
each chunk.  Malloc assigns N bytes out of the
middle of an actual page, maps a new virtual page
to point to that actual page, and returns the
base address of the new virtual page + the offset
into the actual page.

Free just disables the given virtual page.  Thus,
using RAM after it is freed causes a page fault.

Virtual address mapping control also makes threads
simpler; Scheme interpreters would be greatly helped
by this level of control.


-- 

Lance Norskog
thinman AT netcom DOT com
Data is not information is not knowledge is not wisdom.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019