memory-usage

Why does my script use so much more memory when run with mod_perl?

I'm trying to learn how to profile perl memory. I have a very simple Perl hello-world script and I want to know its size in memory. I use GTop utility to measure the memory (recommended in mod_perl book by Stas Beckman). GTop provides the results that confuse me. When I run the script from the command line GTop says: 7M. When I run i...

Good way to concatenate string representations of objects?

Ok, We have a lot of where clauses in our code. We have just as many ways to generate a string to represent the in condition. I am trying to come up with a clean way as follows: public static string Join<T>(this IEnumerable<T> items, string separator) { var strings = from item in items select item.ToString(); return string.Join...

LRU LinkedHashMap that limits size based on available memory

I want to create a LinkedHashMap which will limit its size based on available memory (ie. when freeMemory + (maxMemory - allocatedMemory) gets below a certain threshold). This will be used as a form of cache, probably using "least recently used" as a caching strategy. My concern though is that allocatedMemory also includes (I assume) u...

Can I get a breakdown of memory use?

Can I get a better breakdown of memory use from within my app than GC.GetTotalMemory? For example per-assembly or per-module? Does that even make sense? ...

HttpContext.Cache Physical Memory Usage

Is there any way to find the number of bytes of memory that are currently in the HttpContext.Cache? I've found where you can get the physical memory limit using EffectivePrivateBytesLimit or EffectivePercentagePhysicalMemoryLimit, but I'm having difficulties finding the current physical memory usage. Any ideas ? ---UPDATE--- Afer som...

C/C++ memory usage API in Linux/Windows

I'd like to obtain memory usage information for both per process and system wide. In Windows, it's pretty easy. GetProcessMemoryInfo and GlobalMemoryStatusEx do these jobs greatly and very easily. For example, GetProcessMemoryInfo gives "PeakWorkingSetSize" of the given process. GlobalMemoryStatusEx returns system wide available memory. ...

How to debug a MemoryError in Python? Tools for tracking memory use?

I have a Python program that dies with a MemoryError when I feed it a large file. Are there any tools that I could use to figure out what's using the memory? This program ran fine on smaller input files. The program obviously needs some scalability improvements; I'm just trying to figure out where. "Benchmark before you optimize", as...

Heap fragmentation and windows memory manager

Hi, I'm having trouble with memory fragmentation in my program and not being able to allocate very large memory blocks after a while. I've read the related posts on this forum - mainly this one. And I still have some questions. I've been using a memory space profiler to get a picture of the memory. I wrote a 1 line program that conta...

How can I reduce memory usage of a Twisted server?

I wrote an audio broadcasting server with Python/Twisted. It works fine, but the usage of memory grows too fast! I think that's because some user's network might not be good enough to download the audio in time. My audio server broadcast audio data to different listener's client, if some of them can't download the audio in time, that m...

Java Library Size

If I'm given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused library affect the application's performance? Does the JVM do lazy loading of classes, does having a larger class library necessarily mean a l...

Fopen failing for binary file

I have a huge binary file which is 2148181087 bytes (> 2gb) I am trying to do fopen (file, "r") and it failed with Can not open: xyz file (Value too large to be stored in data type) I read on the man page EOVERFLOW error is received when the file size > 2gb. The weird thing is, I use a different input file which is also "almo...

Java - how to determine the current load

Hi all, How would I determine the current server load? Do I need to use JMX here to get the cpu time, or is there another way to determine that or something similar? I basically want to have background jobs run only when the server is idle. I will use Quartz to fire the job every 30 minutes, check the server load then proceed if it i...

Process monitoring

Hi, Is there an application that is capable of monitoring AND logging information (to file) about another process (in particular IIS aspnet_wp.exe) like (in periods of time): - memory usage of process - cpu usage Or maybe there is another way to monitor IIS process? Thanks Pawel ...

What is a "Sync Block" and tips for reducing the count

We have a Windows Forms application that uses a (third party) ActiveX control, and are noticing in the .NET performance objects under ".NET CLR Memory" that the number of "Sink Blocks" in use is constantly increasing (along with increasing memory usage), even though our application is sitting there idle. The built-in explanation for th...

Serving multiple Rails applications through one ruby interpreter instance

Hi, Given that each Ruby-On-Rails application needs at least about 40MBs of memory, I was wondering if there is a way of running multiple rails-application instances (different ones) over one interpreter of Ruby so that all shared libraries (rmagick etc) are shared between different application instances, saving space. If that would b...

DOM vs Array - memory use

For example I have a list of 100 strings, and 100 span's with this strings. How do you think, how much span's takes more memory than array of strings. Is there possibility to measure? Is there optmisation to unvisible DOM? ...

Out of memory error while creating huge XML

Hi, Caused by: java.lang.OutOfMemoryError: Java heap space at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source) at java.lang.AbstractStringBuilder.append(Unknown Source) at java.lang.StringBuffer.append(Unknown Source) at java.io.StringWriter.write(Unknown Source) at com.ctc.wstx.sw.BufferingXmlWriter.flushBuffer(Buffe...

Ejabberd Memory Consumption (or Leak?)

I'm using ejabberd + mochiweb on our server. The longer I keep ejabberd and mochiweb running, the more memory is consumed (last night it was consuming 35% of memory. right now it's a bit above 50%). I thought this was just a mnesia garbage collection issue - so I installed Erlang R13B3 and restarted ejabberd. This didn't fix it thoug...

Should I aggressively release memory while reading a file line by line in Perl?

Should I aggressively release memory while reading a file, line by line? An example: while (<FILE>) { my $line = $_; <process line> undef($line); } "Undefing" the $line variable is a good option for reducing memory consumption? ...

C Program on Linux to exhaust memory

I would like to write a program to consume all the memory available to understand the outcome. I've heard that linux starts killing the processes once it is unable to allocate the memory. Can anyone help me with such a program. I have written the following, but the memory doesn't seem to get exhausted: #include <stdlib.h> int main() ...