View unanswered posts | View active topics
|
Page 1 of 1
|
[ 5 posts ] |
|
| Author |
Message |
|
coltain
|
Post subject: .cfg file question Posted: Wed Dec 19, 2007 2:17 pm |
|
Joined: Tue Mar 20, 2007 7:17 am Posts: 101 Location: Poland
|
|
When I read a cfg file (using ReadConfigFile(filename)) do I have to unload this .cfg file??? Or is it unloaded automaticly when script ends (or exits by return)???
|
|
| Top |
|
 |
|
tekproxy
|
Post subject: Posted: Thu Dec 20, 2007 9:08 am |
|
 |
| Distro Developer |
 |
Joined: Thu Apr 06, 2006 5:11 pm Posts: 350 Location: Nederland, Texas
|
|
You don't have to but it's good practice to.
If you do not unload it it should be unloaded for you when it's no longer referenced.
|
|
| Top |
|
 |
|
Austin
|
Post subject: Posted: Thu Dec 20, 2007 4:58 pm |
|
 |
| POL Developer |
 |
Joined: Wed Jan 25, 2006 2:30 am Posts: 419 Location: San Diego, California
|
|
When you load a config file with ReadConfigFile() it parses it and stores it internally for faster usage later on when you use it in other scripts (it has to be read in the same way though)
If you unload it in a script, it removes the data from the cache and has to be reparsed again.
_________________ -Austin
|
|
| Top |
|
 |
|
coltain
|
Post subject: Posted: Sat Dec 22, 2007 3:28 pm |
|
Joined: Tue Mar 20, 2007 7:17 am Posts: 101 Location: Poland
|
|
So what is better???
for eg.
I have readconfigfile(something) in my AI script (for setup). This script is used by about 10000 mobiles. Is it better not to unload this config after setup or it is better to unload it?
|
|
| Top |
|
 |
|
Austin
|
Post subject: Posted: Sat Dec 22, 2007 3:41 pm |
|
 |
| POL Developer |
 |
Joined: Wed Jan 25, 2006 2:30 am Posts: 419 Location: San Diego, California
|
|
If you only need a config file once then unload it.
If you write to a config file you must unload it to have it updated in memory.
Most the time you don't want to unload a config file because it will have to be removed/reread.
The config file on the first use is parsed and stored in memory.
Every time after that, it is retrieved from memory for speed.
If you call UnloadConfigFile() then the next time ReadConfigFile() is used, the file must be read from disk and parsed back into memory.
_________________ -Austin
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|