| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Memory matters |
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? JB> no, atexit causes the specified function to be run when the program exits. JB> you could put a kind of destructor in it... A class destructor is also in that way, It's just beeing runed if the program exist or if you free'ed the object. JB> if the configuratuion information has a known size don't use an allocated JB> struct for it just use a global variable. The problem is that it's not known. A element could be in 10 bytes or it could be in 100 chars... Or like I don't know how many elements of a given structure I shall create. JB> I see now that you have a complicated structure involving pointers to many JB> different types... I do. JB> do you need all of that stuff all the time? Yes some of the information, but it would be problematic if it should read part of the structure into memory several times while the programming is running. I really doubt it would give me any bennefits. JB> ca two or more copies of yourt program safely coexist? It wouldn't be a good idea.. I shall have a semaphore for avoiding that.. Like you're not running your tosser two times at the same time aren't you? ;) 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™.