home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.os.os2.programmer:4343 comp.lang.c:12559
- Newsgroups: comp.os.os2.programmer,comp.lang.c
- Path: sparky!uunet!mcsun!ieunet!wsl!jja
- From: jja@wsl.ie (John J. Allen)
- Subject: Re: malloc causes a segmentation violation!?
- Message-ID: <1992Aug20.092700.8373@wsl.ie>
- Organization: Project Papyrus, AIRAID, Dublin, Ireland
- References: <harris.714243433@garfield.catt.ncsu.edu>
- Date: Thu, 20 Aug 1992 09:27:00 GMT
- Lines: 25
-
- harris@garfield.catt.ncsu.edu (Michael Harris) writes:
- : mn87504@cs.tut.fi (Naatula Mika) writes:
- :
- : >I thought that OS/2 could detect writes to non-allocated areas and
- : >give me a segmentation fault right away. Like it usually does.
- :
- : What you have to understand is that the area IS allocated as far as the
- : operating system is concerned. It is allocated to your process. Since your
- : process owns it, the operating system is very happy to let you write there.
- :
- : Memory protection in OS/2 protects one process from another... not a process
- : from itself.
-
- OS/2 2.0 = Flat memory model
- OS/2 1.x = Segmented memory model.
-
- The segmented memory model had some advantages over the flat model. If I
- used DosAllocSeg() to create a 20k block and then ran off the end of
- it I'd get a segmentation violation as soon as I did that. (As in Win 3.x)
-
- So although the FLAT memory model simplifies programming it hampers
- debugging.
-
- Well as they say "You can't have your cake and eat it too"
-
-