Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: jdevlin <jdevlin@pollux.usc.edu>
Subject: comp.sys.dec
Date: 1998/05/30	[thread overview]
Message-ID: <ekaaf7z21sc.fsf@pollux.usc.edu> (raw)



When I use malloc() within a function, the memory allocated byt the call
is being reused -- as if it was returned to the heap despite the fact
that I haven't free()'d it.

The malloc() man page says that this is precisely the behavior you'd
expect of alloca() when the alloca.h file is included.  Apparently
this function allocates space from the stack area which presumably
gets popped off as the function exits.  

So for some reason or other malloc() is behaving like alloca() when
it shouldn't be (as far as I can tell).  I want space allocated from
the heap and not returned to it until I free() it.  Can anyone suggest
either what I'm doing wrong or how I can change this behavior?

As far as I can tell malloc() has not been setup as a macro for alloca().
In addition, the behavior goes away when the code is run in dxladebug
without modifications.

Any help would be appreicated.

The code was compiled using /bin/cc on a Dec Alpha:
uname -a = "OSF1 bravo.lang.psyc.bbk.ac.uk V4.0 878 alpha"

						- Joe

*************************************************************************
Joseph Devlin, PhD                 * 
Center for Speech and Language     * email: j.devlin@psyc.bbk.ac.uk
Birkbeck College                   * 
London  WC1E 7HX                   * "The axon doesn't think.
Phone: 0171-631-6325               *  It just ax."  George Bishop
Fax:   0171-631-6587               *
*************************************************************************




             reply	other threads:[~1998-05-30  4:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-30  4:00 jdevlin [this message]
  -- strict thread matches above, loose matches on Subject: below --
1994-01-14  1:58 comp.sys.dec Grover Furr
1994-01-14 15:54 ` comp.sys.dec acssysdsc
1994-01-14 17:15   ` comp.sys.dec Dan Wing
1994-01-18  3:03 ` comp.sys.dec Barton F. Bruce / CCA
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox