Hi Wang I've got a question. Maybe I do something wrong but my implemation of a drawtext function gives a memory leak if I add something to the output. For example the following BASIC code gives that memory leak:
' mousetest
KEY_ESC = 59
screen (640,480,"Mousetest")
hidemouse
do
cls
drawtext (100,100,"MouseX: "+str(mouseX))
drawtext (100,112,"MouseY: "+str(mouseY))
drawtext (100,124,"MouseButton: "+str(mousebutton))
drawtext (100,136,"MouseWheel: "+str(mousewheel))
if mousebutton = 1 then showmouse
if mousebutton = 2 then hidemouse
sync
until keystate (KEY_ESC) = true
end
I tried another way with the same result...
' mousetest
KEY_ESC = 59
screen (640,480,"Mousetest")
hidemouse
do
cls
xm=str (mouseX)
drawtext (100,100,"MouseX: ")
drawtext (160,100,xm)
if mousebutton = 1 then showmouse
if mousebutton = 2 then hidemouse
sync
until keystate (KEY_ESC) = true
end
If I comment the line with str() out and do the following
xm="320"
then there's no memory leak. So it seems to me that there is a problem with the str() function...?
EDIT: Seems to be confirmed. The following program which does not output anything has a memory leak:
' mousetest
KEY_ESC = 59
screen (640,480,"Mousetest")
hidemouse
do
cls
xm=str (mouseX) 'instead of mousex I can also use a number but the result is still the same: memory leak
sync
until keystate (KEY_ESC) = true
end