2015-10-11 22:21 GMT+02:00 Henrik Nergaard <henrin10@student.uia.no>:
It looks like the taskbarThumbnails might be leaking memory.
When moving the mouse across the taskbar viewing the different thumbnails the memory usage increases by quite a lot (viewed in the taskmanager (Windows) ).
I made an example script to illustrate the resource usage.
Test scenario: 20 windows;
1 Playground, 19 Nautilus browsers (these are minimized).
=============== Create Test Scenario ========================
19 timesRepeat: [
Nautilus openOnClass: Object.
World doOneCycle.
].
World doOneCycle.
World submorphs
select: [ :m |
m isKindOf: NautilusWindow
]
thenDo: [ :m | m minimize ]
===== Enumerate the mouse moving from one taskbarButton to the next =======
| delay |
delay := [ :msToWait |
| t |
t := Time now asMilliSeconds.
[ (Time now asMilliSeconds - t) < msToWait ]
whileTrue: [ World doOneCycle ].
].
20 timesRepeat: [
World submorphs
detect: [:m | m isTaskbar ]
ifFound: [ :taskbar |
taskbar orderedTasks collect: [ :task |
task morph
]
thenDo: [ :morph |
| button |
button := (taskbar taskButtonOf: morph).
morph taskbarButtonEntered: button event: nil in: nil.
delay value: 100.
morph taskbarButtonLeft: button event: nil in: nil.
delay value: 100
]
].
Smalltalk garbageCollect.
].
============================================================
Results: (Newest Win vm -> Image 50377)
opening the 20 Windows RAM used is 70MB.
1 iteration: 93MB
20 iterations: 130MB \ 190 MB when garbageCollect is commented out.
Should the resource usage be that high?
No, this looks bad. Maybe this is because every thumbnail creates a new form to draw on. This is not needed in this case, as there is only one thumbnail view visible at time. But I doubt that this is the reason, because we are creating Forms all over the place and the thumbnail view forms aren't special.
(a taskbarThumbnail is deleted before the next one is shown...)
Best regards,
Henrik