I seem to have a memory leak. I use Windows Task Manager to monitor memory usage. This program consumes memory as it runs. (It’s part of a larger program).
Suggestions?
from ti_image import *
from ti_draw import *
from math import *
from ti_system import *
from time import *
import gc
def my_time(t):
gc.collect()
h=str(t[3]//10)+str(t[3]%10)
m=str(t[4]//10)+str(t[4]%10)
s=str(t[5]//10)+str(t[5]%10)
return h+" : "+m+" : "+s
background=(0,0,0)
white=(255,255,255)
ptime=0
while get_key() != "esc":
# this loop only updates the time every second...
# gc.collect()
local=localtime()
lt=local[5] # seconds
if lt!=ptime:
# update local time...
set_color(0,0,0)
fill_rect(0,195,318,30)
set_color(255,255,255)
draw_text(5,212,"Local time: "+my_time(local))
# paint_buffer()
ptime=lt
Be kind,
John
After running for about a minute, the Memory jumps from around 400mb to over 1gb. Soon the software slows down and eventually fails to respond.
--
--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
https://sites.google.com/site/tinspiregroup/classroom-news/welcome-abouttime
---
You received this message because you are subscribed to the Google Groups "tinspire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tinspire+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tinspire/003201d90524%2495cf4290%24c16dc7b0%24%40gmail.com.
And memory is not released when the program ends.
From: tins...@googlegroups.com <tins...@googlegroups.com> On Behalf Of John Hanna
Sent: Wednesday, November 30, 2022 8:31 PM
To: tins...@googlegroups.com
Subject: [tinspire] problem with memory
I seem to have a memory leak. I use Windows Task Manager to monitor memory usage. This program consumes memory as it runs. (It’s part of a larger program).
--