| View previous topic :: View next topic |
| Author |
Message |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Nov 21, 2002 8:17 pm Post subject: ok |
|
|
ok mac BUT if you don't have a whole txt file in a var lets say you have one line like but you have may lines like this
%%tim = timwhatever
HOW much memory would you save on somethimes like that? the resaon i'am asking yes i have more then one varible so i would like to cal. it out how much (about) i would save if i clear all my var.
thanks |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Nov 21, 2002 9:00 pm Post subject: |
|
|
Each character in a text file is approx one byte, so
if you have 10 chars in a var, clearing it should
free up about 10 bytes of memory (I think).
Someone correct me if this is not true...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Nov 21, 2002 9:30 pm Post subject: |
|
|
NEWS FLASH! Sheep was correct...
VDS does NOT release vars when they are cleared
(VDS3 doesn't anyway). Since I didn't want to hand
code over a hundred vars to check this, I wrote this
program that writes the actual DSC file to test the
theory. The first 120 load and clear just fine, but
the second group doesn't (VDS3 has a 128 custom
var limit).
Would one of you guys test this with VDS4?
Run this, then run the testA.dsc file that it creates.
__________________________________________________________________________________________________________________________
| Code: |
LIST CREATE, 1
%n = 1
REPEAT
%x = 1
REPEAT
LIST ADD, 1, "%%"var%n_%x = @prod(%x, 10)
%x = @succ(%x)
UNTIL @greater(%x, 120)
LIST ADD, 1, INFO @prod(120, %n) vars loaded...
%x = 1
REPEAT
LIST ADD, 1, "%%"var%n_%x = @chr(34)@chr(34)
%x = @succ(%x)
UNTIL @greater(%x, 120)
LIST ADD, 1, INFO @prod(120, %n) vars cleared...
%n = @succ(%n)
UNTIL @greater(%n, 3)
LIST ADD, 1, "INFO Finished.@cr()360 different vars have been loaded and cleared - 120 at a time."
LIST SAVEFILE, 1, @path(%0)testA.dsc
INFO DSC file @path(%0)testA.dsc has been created.
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Nov 21, 2002 9:44 pm Post subject: |
|
|
Why's it such a big news flash that I was right? It happens sometimes
Ran with VDS 4 and got invalid varible name or too many variables at:
%%var3_17 = 170 _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Nov 21, 2002 9:46 pm Post subject: |
|
|
LOL, who said that was the news flash...
Maybe the news was the vars...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Nov 21, 2002 9:49 pm Post subject: sooo |
|
|
there is no way clear var to get more memory  |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Nov 21, 2002 9:50 pm Post subject: |
|
|
BTW, Sheep - Thanks for running the test.
So now we know that VDS3 and VDS4 both don't
release vars once they're initialized...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Nov 21, 2002 9:52 pm Post subject: |
|
|
Well Tim, clearing the var still releases the memory used
by its' contents.
The best thing to do is as Sheep first suggested, re-use
the same vars as much as possible, and use the minimum
amount that's practical.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Nov 21, 2002 9:53 pm Post subject: |
|
|
LoL, that would mean you didn't take the chance to make fun of me Mac...you must be slipping
Tim, if you don't have a bunch of variables holding like 10,000 characters, you shouldn't have to worry about them taking up memory.
[Edit] Hmm, I still think memory is set aside for the variable, whether it holds 1,000 characters or none at all. Going to check on my XP computer..anyone have a better test than the XP task manager? _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Nov 21, 2002 10:15 pm Post subject: |
|
|
I never said the var was the news... I said MAYBE...
Try this (give it a few seconds):
| Code: |
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,Test Program,-1,0,300,60
DIALOG ADD,STATUS,Stat3
DIALOG ADD,STATUS,Stat2
DIALOG ADD,STATUS,Stat1
DIALOG SHOW
DIALOG SET, Stat1, No vars - Free memory: @sysinfo(FREEMEM) kb
WAIT 2
%x = 0
REPEAT
%s = %s"This a long line of text for the var test we are doing..."
%x = @succ(%x)
UNTIL @greater(%x, 1000)
DIALOG SET, Stat2, Vars loaded - Free memory: @sysinfo(FREEMEM) kb
WAIT 2
%s = ""
%x = ""
DIALOG SET, Stat3, Finished. Vars cleared - Free memory: @sysinfo(FREEMEM) kb
:EVLOOP
WAIT EVENT
goto @event()
:CLOSE
EXIT
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361

Last edited by Mac on Thu Nov 21, 2002 10:17 pm; edited 1 time in total |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Nov 21, 2002 10:16 pm Post subject: |
|
|
It shows that the programs memory usage stays the same(2,172k) from when it's opened to when it's closed when using %%Test1 = "" etc. to clear the variables.
So, looks like to me trying to clear variables doesn't gain anything except knowing later on in the program that the variable holds nothing.
Of course I'm still open to try other tests if anyone has any.
Also I hadn't noticed before that VDS 4 has a line wrap after about 550 characters..I was using variables called %%Test1 through 10 holding 540 characters, anymore than that would wrap to the next line and VDS saw it as another (invalid)command. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Nov 21, 2002 10:18 pm Post subject: |
|
|
We posted together - try my example...
Make sure nothing else is running...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Nov 21, 2002 10:22 pm Post subject: |
|
|
Mac,
That test shows that with var's I lose about 130k then get back about 60k when they are cleared.
Note: Too bad we don't have a developer of VDS around to butt in on questions like these.. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Nov 21, 2002 10:27 pm Post subject: |
|
|
Oh and tim, to try and answer your question thuroughly(spelling?) try to reuse variables when you can, and if your variables hold alot of info, clear them, if not I doubt you will gain much. It looks like clearing a variable holding a large amount of data will gain some of the memory back from it. _________________ -Sheep
My pockets hurt...
Last edited by SnarlingSheep on Thu Nov 21, 2002 10:30 pm; edited 1 time in total |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Nov 21, 2002 10:28 pm Post subject: |
|
|
Yeah, I don't get back near as much as I expected
either Sheep. I dunno if there's a point where that
would change or not. Maybe VDS uses/allows a
minimum amount of RAM, and larger programs
might release more?
I dunno...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
|
|
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 vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|