memory

Pandas/Python memory spike while reading 3.2 GB file

微笑、不失礼 提交于 2020-01-01 16:40:49
问题 So I have been trying to read a 3.2GB file in memory using pandas read_csv function but I kept on running into some sort of memory leak, my memory usage would spike 90%+ . So as alternatives I tried defining dtype to avoid keeping the data in memory as strings, but saw similar behaviour. Tried out numpy read csv, thinking I would get some different results but was definitely wrong about that. Tried reading line by line ran into the same problem, but really slowly. I recently moved to python 3

PyAudio Memory Error

亡梦爱人 提交于 2020-01-01 16:05:53
问题 I am having an issue with my code which causes a memory error. I believe it is caused by this function (see below). def sendAudio(): p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = RATE, input = True, output = True, frames_per_buffer = chunk) data = stream.read(chunk) client(chr(CMD_AUDIO), encrypt_my_audio_message(data)) def keypress(event): if event.keysym == 'Escape': root.destroy() if event.keysym == 'Control_L': #print("Sending Data...") sendAudio()

.NET Garbage Collection behavior (with DataTable obj)

流过昼夜 提交于 2020-01-01 15:10:36
问题 I am wondering why after creating a very simple DataTable and then setting it to null does the Garbage Collection not clear out all the memory used by that DataTable. Here is an example. The variable Before should be equal to Removed but it is not. { long Before = 0, After = 0, Removed = 0, Collected = 0; Before = GC.GetTotalMemory(true); DataTable dt = GetSomeDataTableFromSql(); After = GC.GetTotalMemory(true); dt = null; Removed = GC.GetTotalMemory(true); GC.Collect(); Collected = GC

.NET Garbage Collection behavior (with DataTable obj)

試著忘記壹切 提交于 2020-01-01 15:09:31
问题 I am wondering why after creating a very simple DataTable and then setting it to null does the Garbage Collection not clear out all the memory used by that DataTable. Here is an example. The variable Before should be equal to Removed but it is not. { long Before = 0, After = 0, Removed = 0, Collected = 0; Before = GC.GetTotalMemory(true); DataTable dt = GetSomeDataTableFromSql(); After = GC.GetTotalMemory(true); dt = null; Removed = GC.GetTotalMemory(true); GC.Collect(); Collected = GC

.NET Garbage Collection behavior (with DataTable obj)

孤街浪徒 提交于 2020-01-01 15:09:24
问题 I am wondering why after creating a very simple DataTable and then setting it to null does the Garbage Collection not clear out all the memory used by that DataTable. Here is an example. The variable Before should be equal to Removed but it is not. { long Before = 0, After = 0, Removed = 0, Collected = 0; Before = GC.GetTotalMemory(true); DataTable dt = GetSomeDataTableFromSql(); After = GC.GetTotalMemory(true); dt = null; Removed = GC.GetTotalMemory(true); GC.Collect(); Collected = GC

When is it appropriate to use C++ exceptions?

老子叫甜甜 提交于 2020-01-01 14:43:16
问题 I'm trying to design a class that needs to dynamically allocate some memory.. I had planned to allocate the memory it needs during construction, but how do I handle failed memory allocations? Should I throw an exception? I read somewhere that exceptions should only be used for "exceptional" cases, and running out of memory doesn't seem like an exceptional case to me.. Should I allocate memory in a separate initialization routine instead and check for failures and then destroy the class

WCF memory usage

折月煮酒 提交于 2020-01-01 14:36:02
问题 I have a WCF service hosting in IIS using net.tcp binding and configured for PerCall instancing. For test purposes, I have a single operation that does absolutely nothing. Every time a client connects and calls the operation, memory usage increases for the w3wp.exe process and after the client has closes the connection, the memory usage does not decrease. After repeated calls, the memory has increased from an initial 20MB to 500MB or more. Is this normal behavior? 回答1: When you call a service

AIX操作系统的CPU、Memory、Filesystem、Paging、I/O监控

大憨熊 提交于 2020-01-01 12:42:18
项目地址: https://github.com/zhangrj/Aix-Monitor 1、CPU使用率 CPU使用率 = 100% – CPU idle time CPU ilde time可取4秒内的平均值。例如: root@**:/ # vmstat 1 4 System configuration: lcpu=32 mem=63488MB kthr memory page faults cpu ----- ----------- ------------------------ ------------ ----------- r b avm fre re pi po fr sr cy in sy cs us sy id wa 0 0 9247706 3838878 0 0 0 0 0 0 3 321 300 0 0 99 0 0 0 9247706 3838876 0 0 0 0 0 0 10 145 302 0 0 99 0 0 0 9247706 3838876 0 0 0 0 0 0 2 54 279 0 0 99 0 0 0 9247706 3838876 0 0 0 0 0 0 3 78 285 0 0 99 0 写成脚本: #!/bin/ksh cpu_idle_list=$(/usr/bin/vmstat 1 4 | egrep -v '[a-z,A-Z]

memory overflow when using numpy load in a loop

孤街醉人 提交于 2020-01-01 12:15:43
问题 Looping over npz files load causes memory overflow (depending on the file list length). None of the following seems to help Deleting the variable which stores the data in the file. Using mmap. calling gc.collect() (garbage collection). The following code should reproduce the phenomenon: import numpy as np # generate a file for the demo X = np.random.randn(1000,1000) np.savez('tmp.npz',X=X) # here come the overflow: for i in xrange(1000000): data = np.load('tmp.npz') data.close() # avoid the

App crashes on launch with < 256 RAM iOS Devices

纵饮孤独 提交于 2020-01-01 12:11:24
问题 The Info I recently launched an app on the AppStore. After testing on the simulator thousands of times, and actual devices hundreds of times we finally released our app. The Problem Reviews started popping up about app crashes when the user launches the app. We figured that the app crashes on launch on iOS devices with less than (or equal to) 256 Mb of RAM . The following devices are devices our app supports with less than 256: iPod Touch 4G iPhone 3GS iPad 1 The app doesn't always crash.