Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!ucsd!dog.ee.lbl.gov!ux5.lbl.gov!peterli From: peterli@ux5.lbl.gov Newsgroups: comp.lang.c++ Subject: Re: Distinguishing stack and heap objects Message-ID: <8877@dog.ee.lbl.gov> Date: 5 Jan 91 07:52:40 GMT References: <1990Dec29.013620.23761@sjsumcs.sjsu.edu> Reply-To: peterli@ux5.lbl.gov () Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 12 X-Local-Date: Fri, 4 Jan 91 23:52:40 PST In article <1990Dec29.013620.23761@sjsumcs.sjsu.edu> horstman@sjsumcs.SJSU.EDU (Cay Horstmann) writes: >Recently someone asked whether one can distinguish objects allocated with >new from those allocated on the stack, and it just occurred to me that this >is possible. Ignore this if the technique is an old hat, it is new to me. > >Cay For platforms with uniform address space and where stack and data grows toward each other, then you should be able to use sbrk(0). Read man pages end(3) and sbrk(2). Peter Li