giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.31k stars 1.39k forks source link

[windows] Anaconda showing negative memory usage when using a higher memory #1621

Open ping543f opened 5 years ago

ping543f commented 5 years ago

Platform

Bug description { a clear and concise description of what the bug is }

traceback message (if any)
import pandas as pd
from apyori import apriori
import os
import time
import psutil

def get_process_memory():
    process = psutil.Process(os.getpid())
    return process.memory_info().rss

init_mem = get_process_memory()
init_time = time.perf_counter()

mushroom_data = pd.read_csv('mushroom.csv', header = None)

num_records = len(mushroom_data)
print (num_records)

records = []

for i in range(0,num_records):
    records.append([str(mushroom_data.values[i,j]) for j in range (0,23)])
    print(i,": record appended")

association_rules = apriori(records,min_support=0.2,min_confidence=0.20,min_lift=3,min_length=5)
association_results = list(association_rules)

print (len(association_results))

print (association_results[0])

for item in association_results:
    pair = item[0]
    items = [x for x in pair]
    print("Rule: " + items[0] + "-->" + items[1])
    print("Support: " + str(item[1]))
    print("Confidence: " + str(item[2][0][2]))
    print("Lift: " + str(item[2][0][3]))
    print ("======================================================")

fin_mem = get_process_memory()
fin_time = time.perf_counter()

exec_time = fin_time - init_time
mem_used = fin_mem - init_mem

print ("Execution Time (Seconds): ", exec_time)
print ("Memory Used (Bytes): ", mem_used)

Test results

output of `python -c psutil.tests
[mushroom.zip](https://github.com/giampaolo/psutil/files/3842008/mushroom.zip)

` (failures only, not full result)

{ you may want to do this in order to discover other issues affecting your platform } { if failures look unrelated with the issue at hand open another ticket }

ping543f commented 5 years ago

mushroom.zip the dataset is attached here

giampaolo commented 5 years ago

Please paste the output of these:

import psutil
print(psutil.Process().memory_full_info())
print(psutil.virtual_memory())
giampaolo commented 4 years ago

Bump

ping543f commented 4 years ago

Sorry for being late. the output is pasted below: pfullmem(rss=44335104, vms=268292096, num_page_faults=1074086, peak_wset=174977024, wset=44335104, peak_paged_pool=843128, paged_pool=835568, peak_nonpaged_pool=8627336, nonpaged_pool=234680, pagefile=268292096, peak_pagefile=356388864, private=268292096, uss=33792000) svmem(total=16860880896, available=6037708800, percent=64.2, used=10823172096, free=6037708800)