memory-profiling

real memory vs profiled memory python

安稳与你 提交于 2019-12-11 08:09:13
问题 Using memory_profiler to aid in project that is requiring freeing up some memory at various points. The development environment is OS X snow leopard. The profiled memory, as shown below, is peaking at around 414.699 MiB , but the Activity Monitor is showing the process peaking at nearly twice that (more than 900 MB ). Line # Mem usage Increment Line Contents ================================================ 24 20.441 MiB 0.000 MiB @profile 25 def do_work(): 26 "Call each function in order" 27

numpy.ndarray objects not garbage collected

早过忘川 提交于 2019-12-11 03:26:49
问题 While trying to fine-tune some memory leaks in the Python bindings for some C/C++ functions I cam across some strange behavior pertaining to the garbage collection of Numpy arrays. I have created a couple of simplified cases in order to better explain the behavior. The code was run using the memory_profiler , the output from which follows immediately after. It appears that Python's garbage collection is not working as expected when it comes to NumPy arrays: # File deallocate_ndarray.py

Python: Cannot replicate a test on memory usage

假如想象 提交于 2019-12-10 09:17:15
问题 I was trying to replicate the memory usage test here. Essentially, the post claims that given the following code snippet: import copy import memory_profiler @profile def function(): x = list(range(1000000)) # allocate a big list y = copy.deepcopy(x) del x return y if __name__ == "__main__": function() Invoking python -m memory_profiler memory-profile-me.py prints, on a 64-bit computer Filename: memory-profile-me.py Line # Mem usage Increment Line Contents =====================================

How to Profile JVM memory in the code?

两盒软妹~` 提交于 2019-12-09 01:34:47
问题 I am writing a servlet that I can't test in Eclipse, I need to run on server. I want to do memory profiling and pinpoint any leaks. So, I think I need write debug statements that can tell me current memory usage. Can someone point me to good references on how to do this and/or which classes in the JDK do this ? Note that I can't use the "Eclipse MAT". 回答1: Can't you use the built-in tool in the jdk jvisualvm? 回答2: JConsole to rescue you! 回答3: Profiling application memory and hunting down

Trying to understand python memory profiler

爷,独闯天下 提交于 2019-12-08 07:55:20
问题 I am using Memory Profiler module to get the memory usage of my python code following this answer. However, I am not able to interpret the output from %memit magic (or the output using the @profile decorator from the module or mprof run for that matter). For instance, %memit range(10000) gives me peak memory: 97.41 MiB, increment: 0.24 MiB while, %memit xrange(10000) shows peak memory: 97.46 MiB, increment: 0.00 MiB . I do understand the difference between xrange returning an xrange type as

Determine Python's actual memory usage

空扰寡人 提交于 2019-12-08 07:12:36
问题 I am currently trying to debug the memory usage of my Python program (on Windows with CPython 2.7). But unfortunately, I can't even find any way to reliably measure the amount of memory it's currently using. I've been using the Task Manager/Resource Monitor to measure the process memory, but this appears to only be useful for determining peak memory consumption. Often times Python will not reduce the Commit or Working Set even long after the relevant objects have been garbage collected. Is

Getting memory usage Live/Dirty Bytes in iOS app programmatically (not Resident/Real Bytes)

我们两清 提交于 2019-12-08 00:25:17
问题 According to what I've read so far, real/resident bytes indicates the number of bytes allocated to the app including bytes that the app is no longer using but hasn't been reclaimed by the OS. And live/dirty bytes is the bytes the the app is actually using and the OS can't reclaim. I think that the number shown in XCode Debug navigator is Live Bytes. I'm interested in getting this number programmatically (for our own statistics/analytics), but the code I found can only give the value of

How do I run stand-alone Eclipse MAT?

余生长醉 提交于 2019-12-07 15:50:39
问题 I generated hprof using jmap. sudo ~/jdk/bin/jmap -F -dump:file=app.hprof 5003 Now, I am getting OOM / 'Java Heap Space' error while parsing *.hprof in eclipse. I think I need to run it as stand-alone. How do I run it? any references? 回答1: I assume, you've downloaded Eclipse MAT in the form of Standalone Eclipse RCP Application. If not - do so now, and extract the archive to a folder that suits you. You're getting the OOME, because MAT has too few memory available (the heap-dump you're

Determine Python's actual memory usage

纵然是瞬间 提交于 2019-12-06 16:41:05
I am currently trying to debug the memory usage of my Python program (on Windows with CPython 2.7). But unfortunately, I can't even find any way to reliably measure the amount of memory it's currently using. I've been using the Task Manager/Resource Monitor to measure the process memory, but this appears to only be useful for determining peak memory consumption. Often times Python will not reduce the Commit or Working Set even long after the relevant objects have been garbage collected. Is there any way to find out how much memory Python is actually using, or failing that, to force it to free

Memory profiling in R: how to find the place of maximum memory usage?

别等时光非礼了梦想. 提交于 2019-12-06 10:47:23
问题 My code eats up to 3GB of memory at a single time. I figured it out using gc() : gc1 <- gc(reset = TRUE) graf(...) # the code gc2 <- gc() cat(sprintf("mem: %.1fMb.\n", sum(gc2[,6] - gc1[,2]))) # mem: 3151.7Mb. Which I guess means that there is one single time, when 3151.7 MB are allocated at once. My goal is to minimize the maximum memory allocated at any single time. How do I figure out which part of my code is reposponsible for the maximum usage of those 3GB of memory? I.e. the place where