Memory Usage

Blitz3D Forums/Blitz3D Beginners Area/Memory Usage

Gauge(Posted 2004) [#1]
How can i tell memory usage thats not from video usage?
Or total memory useage in my app?
Also, when you do run a program like the following, how/why does your available video memory go up??

[code]
Ax% = AvailVidMem()/1024
Type room
Field roomname$
Field roomnumber#
Field rcolor
Field exitn
Field exits
Field exite
Field exitw
Field exitne
Field exitnw
Field Exitse
Field exitsw
Field exitu
Field exitd
Field rexits$
Field mvcost
;fields for doors??
;roomarea#?
;field normal_light
;field current_light
Field room1.alsohere[100]
Field room2.lyinghere[100]
End Type

Type alsohere
Field alsoname$
Field alsotype
Field alsoId;?
Field alsostream
End Type

Type lyinghere
Field lyingname$
Field lyingtype
Field lyingid
End Type

Type area
Field areaname$
Field areanumber#
Field ro.room[1000]
Field weather
End Type
;Read Each Line to Get How many Areas
a=1
areafile=OpenFile("c:\mdbmud\areas\areas.dat")
If areafile Then
While Not Eof(areafile)
b$=ReadLine(areafile)
a=a+1
Wend
CloseFile(areafile)
Else
Print "Areas.dat not found, terminating program"
Delay 5000
End
EndIf
a=a-1
Print "Total Areas found: "+a

;dim Area
Dim area.area(a)
c=0
areafile=OpenFile("c:\mdbmud\areas\areas.dat")
;get each areas name

While Not Eof(areafile)
b$=ReadLine(areafile)
area (c)=New area
area(c)\areaname$=b$
c=c+1
Wend
CloseFile(areafile)

d=a-1
For x=0 To d Step 1
c=0
afile$=area(x)\areaname$+".dat"
area(x)\areanumber#=x
curr_file=OpenFile("c:\mdbmud\areas\"+afile$)
If curr_file Then
While Not Eof(curr_file)
b$=ReadLine(curr_file)
area(x)\ro[c]=New room
area(x)\ro[c]\roomname$=b$
area(x)\ro[c]\roomnumber=c
b$=ReadLine(curr_file)
area(x)\ro[c]\rcolor=b$
b=ReadLine(curr_file)
area(x)\ro[c]\exitn=b
b=ReadLine(curr_file)
area(x)\ro[c]\exits=b
b=ReadLine(curr_file)
area(x)\ro[c]\exite=b
b=ReadLine(curr_file)
area(x)\ro[c]\exitw=b
b=ReadLine(curr_file)
area(x)\ro[c]\exitne=b
b=ReadLine(curr_file)
area(x)\ro[c]\exitnw=b
b=ReadLine(curr_file)
area(x)\ro[c]\exitse=b
b=ReadLine(curr_file)
area(x)\ro[c]\exitsw=b
b=ReadLine(curr_file)
area(x)\ro[c]\exitu=b
b=ReadLine(curr_file)
area(x)\ro[c]\exitd=b
b$=ReadLine(curr_file)
area(x)\ro[c]\rexits$=b$
b$=ReadLine(curr_file)
c=c+1
Wend
Else
Print "WARNING: Area file "+afile$+"Not found!!!"
EndIf
Next

j=a-1
;Print j
For l=0 To j Step 1
arean$=area(l)\areaname$
Print "Area#: "+l+" "+arean$
p=0:e=0

While e=0
If area(l)\ro[p]<>Null Then
Print "Room#: "+p+" "+area(l)\ro[p]\roomname$
p=p+1
Else
e=1
EndIf
Wend
Next
Bx% = AvailVidMem()/1024
Print ax%
Print bx%
Print "Video memory usage: " + (Ax - Bx) + "kb"

WaitKey()