so...
1) Durch den Aufbau der funktionen sollte sichergestellt sein, dass jede normale Variable regelmäßig gelöscht wird.
2) Für die self Variablen gebe ich jede stunde nun über sys.getsizeof(self.variable) die Groeße aus. Aber wie erwartet (da sich nie die anzahl der einträge, sondern nur der Wert der Einträge ändert), bleiben alle self Variablen absolut konstant groß und das jetzt schon seit 4 Stunden Laufzeit.
Doch während der 4 stunden laufzeit hat sich die top Info verändert in:
top kurz nach dem Start des skripts (self dictionaries und listen wurden bereits eingefuehrt) als Service:
Code: Alles auswählen
top - 16:13:34 up 69 days, 15:26, 1 user, load average: 0.14, 0.08, 0.06
Tasks: 63 total, 1 running, 62 sleeping, 0 stopped, 0 zombie
%Cpu(s): 6.3 us, 0.3 sy, 0.0 ni, 92.4 id, 0.0 wa, 0.0 hi, 0.3 si, 0.7 st
KiB Mem: 506340 total, 221992 used, 284348 free, 8404 buffers
KiB Swap: 0 total, 0 used, 0 free. 43600 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23015 root 20 0 736180 133204 9148 S 7.3 26.3 0:32.76 python3.4
1 root 20 0 28556 3900 2308 S 0.0 0.8 1:48.58 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 11:44.14 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root 20 0 0 0 0 S 0.0 0.0 56:55.05 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
9 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
10 root rt 0 0 0 0 S 0.0 0.0 1:19.23 watchdog/0
11 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
13 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
14 root 20 0 0 0 0 S 0.0 0.0 0:03.37 khungtaskd
15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback
16 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd
17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 crypto
18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd
19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset
20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd
22 root 20 0 0 0 0 S 0.0 0.0 0:53.53 kswapd0
23 root 20 0 0 0 0 S 0.0 0.0 0:00.00 fsnotify_mark
29 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kthrotld
30 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ipv6_addrconf
31 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 deferwq
65 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff
66 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khubd
67 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0
68 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_0
70 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1
72 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_1
93 root 20 0 0 0 0 S 0.0 0.0 3:15.70 jbd2/vda1-8
94 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ext4-rsv-conver
137 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kauditd
157 root 20 0 37424 5052 2648 S 0.0 1.0 188:31.06 systemd-journal
161 root 20 0 40792 476 4 S 0.0 0.1 0:00.07 systemd-udevd
194 root 20 0 0 0 0 S 0.0 0.0 0:00.00 vballoon
196 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kpsmoused
271 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kvm-irqfd-clean
448 root 20 0 37068 420 0 S 0.0 0.1 0:21.22 rpcbind
460 statd 20 0 37268 596 8 S 0.0 0.1 0:00.00 rpc.statd
476 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 rpciod
478 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 nfsiod
487 root 20 0 23348 200 0 S 0.0 0.0 0:00.00 rpc.idmapd
top nach ca. 4 Stunden Laufzeit. Die self. Variablen haben noch immer dieselbe Groeße: (nicht derselbe Tag)
Code: Alles auswählen
top - 19:48:26 up 70 days, 19:01, 1 user, load average: 0.48, 0.73, 0.72
Tasks: 63 total, 2 running, 61 sleeping, 0 stopped, 0 zombie
%Cpu(s): 17.4 us, 0.3 sy, 0.0 ni, 81.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.3 st
KiB Mem: 506340 total, 450848 used, 55492 free, 53904 buffers
KiB Swap: 0 total, 0 used, 0 free. 184152 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3287 root 20 0 752816 166400 8888 R 18.6 32.9 94:52.60 python3.4
1 root 20 0 28556 3848 2256 S 0.0 0.8 1:50.87 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 11:54.21 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root 20 0 0 0 0 S 0.0 0.0 57:44.45 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
9 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
10 root rt 0 0 0 0 S 0.0 0.0 1:20.44 watchdog/0
11 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
13 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
14 root 20 0 0 0 0 S 0.0 0.0 0:03.43 khungtaskd
15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback
16 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd
17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 crypto
18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd
19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset
20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd
22 root 20 0 0 0 0 S 0.0 0.0 0:53.73 kswapd0
23 root 20 0 0 0 0 S 0.0 0.0 0:00.00 fsnotify_mark
29 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kthrotld
30 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ipv6_addrconf
31 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 deferwq
65 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff
66 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khubd
67 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0
68 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_0
70 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1
72 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_1
93 root 20 0 0 0 0 S 0.0 0.0 3:18.52 jbd2/vda1-8
94 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ext4-rsv-conver
137 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kauditd
157 root 20 0 37424 6104 3700 S 0.0 1.2 191:51.68 systemd-journal
161 root 20 0 40792 476 4 S 0.0 0.1 0:00.07 systemd-udevd
194 root 20 0 0 0 0 S 0.0 0.0 0:00.00 vballoon
196 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kpsmoused
271 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kvm-irqfd-clean
448 root 20 0 37068 1588 1168 S 0.0 0.3 0:21.55 rpcbind
460 statd 20 0 37268 596 8 S 0.0 0.1 0:00.00 rpc.statd
476 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 rpciod
478 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 nfsiod
487 root 20 0 23348 200 0 S 0.0 0.0 0:00.00 rpc.idmapd
Wie bereits in vorherigen Posts erwähnt:
Das skript läuft als Service im Hintergrund. Die letzten prints (ungefähr der letzten stunde), sind vermutlich im systemd-journal gespeichert. Zusätzlich werden txt Dateien erstellt um über die Vorgänge informiert zu sein.
Wenn es nicht an der größe der Variablen liegt, woran kann es dann liegen?
Wir sehen also, über die variablen komme ich nicht weiter. Daher wäre sowas wie memory_profiler, welches den zusätzlich gebrauchten Memory pro Zeile angibt, schon sehr gut. Aber es muss halt auch mit einer while schleife mit mehreren Stunden Betrieb klappen, sonst ist es leider ziemlich nutzlos...