TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Bo Simonsen
from: Jasen Betts
date: 2003-10-18 06:33:18
subject: Memory matters

Hi Bo.

16-Oct-03 15:47:29, Bo Simonsen wrote to Jasen Betts


 BS> Hello Jasen!

 BS> Oct 15 06:28 03, Jasen Betts wrote to Bo Simonsen:

 BS>>> In my file ticker, I'm reading the configuration into a
 BS>>> structure.. This structure do I need all the time, so I figured
 BS>>> is it nessersary to free it then I'm ending the program

 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.

 BS> Indeed, just a big work to free a structure with mutch allocated
 BS> memory, is there a easy way for free'ing such a thing

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

 BS> atexit is like a class destructer?

no, atexit causes the specified function to be run when the program exits.
you could put a kind of destructor in it...

 JB>> another is not to allocate them but instead have them as ordinary
 JB>> global variables

 BS> ?

if the configuratuion information has a known size don't use an allocated
struct for it just use a global variable.

I see now that you have a complicated structure involving pointers to many
different types...

do you need all of that stuff all the time?

ca two or more copies of yourt program safely coexist?

 -=> Bye <=-

---
* Origin: One less than the checksum of "Jasen Betts" (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/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™.