Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table要素のメモリリーク #57

Closed
kujirahand opened this issue Jun 12, 2024 · 0 comments
Closed

Table要素のメモリリーク #57

kujirahand opened this issue Jun 12, 2024 · 0 comments

Comments

@kujirahand
Copy link
Owner

以下のようなコードでメモリリークが発生することを確認しました。

# Table memory test
# import PySimpleGUI as eg

import TkEasyGUI as eg
import random

headings = [f"col{i}" for i in range(20)]
values = [[f"({i},{j})" for j in range(20)] for i in range(100)]

layout = [
    [eg.Table(values=values, headings=headings, key="-table-", enable_events=True, expand_y=True)],
    [eg.HSeparator()],
    [eg.Button("Change"), eg.Button("Close")],
]
# create window
window = eg.Window(
    "Table memory test", layout, resizable=True, size=(800, 600))

def change_values(win):
    win["-table-"].update(
        values=[[
                f"({i},{j}={random.randint(11111,99999)})" for j in range(20)
            ] for i in range(10_000)])

# event loop
while True:
    event, values = window.read(timeout=1000)
    if event == "Change":
        change_values(window)
    elif event == "Close" or event == eg.WIN_CLOSED:
        break
    elif event == eg.TIMEOUT_KEY:
        change_values(window)
window.close()

できるだけ丁寧にメモリ解放するように調整します。

#56 と関係。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant