l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2002 Jul 19 12:52

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] dyanamic memory panacea
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] dyanamic memory panacea



On Tue, Jul 16, 2002 at 12:30:17PM -0700, Peter Jay Salzman wrote:
> the obvious advantage is that the memory is deallocated once the stack
> frame is popped.  in other words, when the function returns, all memory
> allocated by alloca is freed.  this means no memory leaks.  very cool.

  If I remember correctly alloca is used extensively inside gcc source 
code.  If this is correct you can expect it will work on any system 
you can compile gcc on.

  I found this out a few years ago when trying to compile some complex
c++ code with optimization on... g++ was calling large alloca and 
exceeding the ulimit stack size on Linux, upping the limit made it
able to compile with optimizations.


However, the man page is in error:

man alloca
# RETURN VALUE
#        The  alloca function returns a pointer to the beginning of
#        the allocated space.  If the  allocation  failed,  a  NULL
#        pointer is returned.

  alloca as implemented and tested some 6 months back has no error
indication.  If you call alloca it will always return a valid pointer
but as soon as you touch a byte beyond the available space you will
get SIGSEGV.
  I will see if I can dig up the test/bug report... if anyone is curious.
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.