TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Ali Cinar
from: Bo Simonsen
date: 2003-10-18 01:28:58
subject: Memory matters

G'day Ali,

 JB> it's a good idea to free it at the end of the program, but most
 JB> platforms will free it for you if you leave it allocated.

 JB> one handy way to free global allocations is to put 
 AC> all the frees in an
 JB> exitfunction and use atexit() to register it.

 AC> If you are using GNU's C compiler, it comes with a function
 AC> named alloca() (declared in alloca.h) . When you use alloca()
 AC> instead of malloc() in a function, then the compiler automaticaly
 AC> free the memory for you when the function exits/returns.
 AC> It is very useful when dealing with big functions.

Oh that's kinda smart! Then I regret why I didn't make my own memory
function, so I easyly could change that sort of things.. Just bad luck..

Thanks for your reply :-) Just found the man page, quite interesting.

Regards,
Bo


--- Maximus/UNIX 3.03b
* Origin: The Night Express (2:236/100)
SEEN-BY: 633/267 270
@PATH: 236/100 237/9 20/11 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.