memory leak with files

BlitzMax Forums/BlitzMax Programming/memory leak with files

Graphics 640,480,0

While Not KeyHit(KEY_ESCAPE)

	If KeyHit(KEY_SPACE)
		file = ReadFile("test.map")
		CloseFile file
		Release file
	EndIf

	Cls
	DrawText MemAlloced(),0,0
	FlushMem
	Flip
	
Wend
End
or

Graphics 640,480,0

While Not KeyHit(KEY_ESCAPE)

	If KeyHit(KEY_SPACE)
		file:TStream = ReadFile("test.map")
		CloseFile file
	EndIf

	Cls
	DrawText MemAlloced(),0,0
	FlushMem
	Flip
	
Wend
End