Posts

Showing posts with the label memory-management

How to interpret Pythone memory usage with guppy?

Image
Clash Royale CLAN TAG #URR8PPP How to interpret Pythone memory usage with guppy? I am using code for spectral estimation of geophysical time series. import matplotlib.pyplot as plt plt.style.use("ggplot") import numpy as np from mtspec import mtspec from mtspec.util import _load_mtdata from guppy import hpy h = hpy() print h.heap() data = np.loadtxt('500.dat') spec,freq,jackknife,f_statistics,degrees_of_f = mtspec(data=data, delta= 40.0, time_bandwidth=4 ,number_of_tapers=7, nfft= 512, statistics=True) I got this: milenko@milenko-HP-Compaq-6830s:~$ python mt4.py Partition of a set of 214843 objects. Total size = 35303944 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 15461 7 8538896 24 8538896 24 unicode 1 77241 36 7769768 22 16308664 46 str 2 43700 20 3870600 11 20179264 57 tuple 3 582 0 1443984 4 21623248 61 dict of PyQt4.QtCore.pyqtWrapperType 4 352 0 1395712 4 23018...

Linux- Out of Memory

Image
Clash Royale CLAN TAG #URR8PPP Linux- Out of Memory I was trying to see the working of oom_kill by invoking manually. I allocated memory dynamically and tried to use them infinitely with while loop at first and then with the for loop to test out of memory. But in the first case where I used the while loop it threw segmentation fault without swap and became unresponsive with swap whereas with the for loop out of memory (oom_kill) was invoked. Sample codes of both: First case: while: int main (void) { char* p; while (1) { p=malloc(1<<20); memset (p, 0, (1<<20)); } } Second case : for : int main (void) { int i, n = 0; char *pp[N]; for (n = 0; n < N; n++) { pp[n] = malloc(1<<20); if (pp[n] == NULL) break; } printf("malloc failure after %d MiBn", n); for (i = 0; i < n; i++) { ...