Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Slight growth of memory detected

Aperta
#55 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
c, python
Ambito
networking

Direzione di ricerca

Inizia riproducendo il test della memoria fornito con get_active_devices e get_interfaces_info, incluso il caso di un nome di interfaccia non valido. Segui questi punti di ingresso attraverso i binding Python e l’implementazione nativa del repository, quindi ripeti le misurazioni dopo ogni analisi. Il lavoro è completato quando le chiamate ripetute non mostrano più una crescita misurabile della memoria.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

help wanted

Get this script (GPLv2 Copyright (c) 2011 Red Hat):

import ethtool
import subprocess, sys, os

max = int(sys.argv[1])
nic = sys.argv[2]
total = 0

def memory():
    """ Get current memory usage in MB """
    command = "ps --no-header -o rss -p %s" % os.getpid()
    p = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
    stdout, stderr = p.communicate()
    return int(stdout) / 1024

def measure(fun, arg):
    """ Run given function on given arg max times """
    global total
    print("\n%s on %s" % (fun, arg))
    start = None

    for i in range(max + 1):
        result = fun(arg)
        if i % (max / 10) == 0:
            current = memory()
            # note the memory after the first round warm-up
            if start is None:
                start = current
            print("%s %% ... %s MB" % \
                    (str(100 * i / max).rjust(3), str(current).rjust(3)))
    increase = current - start
    print("Memory increase: %s MB" % increase)
    total += increase

measure(ethtool.get_active_devices, None)
measure(ethtool.get_interfaces_info, nic)
measure(ethtool.get_interfaces_info, 'bad interface name')

print("\nTotal memory increase: %s MB" % total)
if total > 0:
    sys.exit(1)

And run:

$ python3.6 ~/tmp/memory.py 1000000 ens3
<built-in function get_active_devices> on None
0.0 % ... 10.1328125 MB
10.0 % ... 10.13671875 MB
20.0 % ... 10.13671875 MB
30.0 % ... 10.13671875 MB
40.0 % ... 10.13671875 MB
50.0 % ... 10.13671875 MB
60.0 % ... 10.13671875 MB
70.0 % ... 10.13671875 MB
80.0 % ... 10.13671875 MB
90.0 % ... 10.13671875 MB
100.0 % ... 10.13671875 MB
Memory increase: 0.00390625 MB

<built-in function get_interfaces_info> on ens3
0.0 % ... 10.13671875 MB
10.0 % ... 10.13671875 MB
20.0 % ... 10.13671875 MB
30.0 % ... 10.13671875 MB
40.0 % ... 10.13671875 MB
50.0 % ... 10.13671875 MB
60.0 % ... 10.13671875 MB
70.0 % ... 10.13671875 MB
80.0 % ... 10.13671875 MB
90.0 % ... 10.140625 MB
100.0 % ... 10.140625 MB
Memory increase: 0.00390625 MB

<built-in function get_interfaces_info> on bad interface name
0.0 % ... 10.140625 MB
10.0 % ... 10.140625 MB
20.0 % ... 10.140625 MB
30.0 % ... 10.140625 MB
40.0 % ... 10.140625 MB
50.0 % ... 10.140625 MB
60.0 % ... 10.140625 MB
70.0 % ... 10.140625 MB
80.0 % ... 10.140625 MB
90.0 % ... 10.140625 MB
100.0 % ... 10.140625 MB
Memory increase: 0.0 MB

Total memory increase: 0.0078125 MB
Lingua principale
C
Stelle
16
Fork
11
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fedora-python/python-ethtool

Tutte le issue di fedora-python/python-ethtool

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.