home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.os.os2.programmer:4362 comp.lang.c:12610
- Newsgroups: comp.os.os2.programmer,comp.lang.c
- Path: sparky!uunet!ferkel.ucsb.edu!taco!garfield.catt.ncsu.edu!harris
- From: harris@garfield.catt.ncsu.edu (Michael Harris)
- Subject: Re: malloc causes a segmentation violation!?
- Message-ID: <harris.714400169@garfield.catt.ncsu.edu>
- Sender: news@ncsu.edu (USENET News System)
- Organization: North Carolina State University
- References: <harris.714243433@garfield.catt.ncsu.edu> <1992Aug20.092700.8373@wsl.ie>
- Date: Fri, 21 Aug 1992 12:29:29 GMT
- Lines: 27
-
- jja@wsl.ie (John J. Allen) writes:
-
- >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.
- >:
-
- >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)
-
- This discussion has nothing to do with Flat vs Segmented memory model. What
- it deals with is WHERE some housekeeping info for your process is kept. True,
- if you used DosAllocSeg() only, you wouldn't experience this particular
- problem. HOWEVER, if you then used DosSubAlloc() you might experience the
- same problem. And then there is the other highly unlikely situation (yet
- still possible) where your pointer is so screwed up that it points back to
- your application stack space.
- ______________________________________________________________________________
- Michael Harris - harris@catt.ncsu.edu or harris@carvm3.vnet.ibm.com
- System Administrator, Computer & Technologies Theme Program, NC State Univ.
- (My opinions are my own and do not represent those of NCSU or IBM Corporation)
-