memory-usage

How many bytes per element are there in a Python list (tuple)?

For example, how much memory is required to store a list of one million (32-bit) integers? alist = range(1000000) # or list(range(1000000)) in Python 3.0 ...

Why is my Perl regex using so much memory?

I'm running a regular expression against a large scalar. Though this match isn't capturing anything, my process grows by 30M after this match: # A if (${$c} =~ m/\G<<\s*/cgs) { #B ... } $c is a reference to a pretty big scalar (around 21M), but I've verified that pos(${$c}) is in the right place and the expression matches at ...

How to get memory usage under Windows in C++

I am trying to find out how much memory my application is consuming from within the program itself. The memory usage I am looking for is the number reported in the "Mem Usage" column on the Processes tab of Windows Task Manager. ...

Memory Usage on convenience method vs init method

Recently when I looked into iPhone memory management, I tried to compare the convenience method and init method on the same object. For example, I have UIImageView where it displays a downloaded NSData: Convenience method: imageView.image = [UIImage imageWithData:[downloads dataAtIndex:0]]; init method: UIImage *aImage = [[UIImage a...

Why the Excess Memory for Strings in Delphi?

I'm reading in a large text file with 1.4 million lines that is 24 MB in size (average 17 characters a line). I'm using Delphi 2009 and the file is ANSI but gets converted to Unicode upon reading, so fairly you can say the text once converted is 48 MB in size. ( Edit: I found a much simpler example ... ) I'm loading this text into a s...

What's the Best Way to Measure Memory Use from a Program?

I've been trying to optimize the Windows program I am developing, trying to find the best data structures that will minimize memory use. It loads large blocks of data, so with huge files, it can use a large amount of RAM. For memory measurement, I have been using GlobalMemoryStatusEx. See: http://msdn.microsoft.com/en-us/library/aa36658...

Is Hibernate good for batch processing? What about memory usage?

I have a daily batch process that involves selecting out a large number of records and formatting up a file to send to an external system. I also need to mark these records as sent so they are not transmitted again tomorrow. In my naive JDBC way, I would prepare and execute a statement and then begin to loop through the recordset. As ...

How can I determine how much memory my .NET program is using?

It seems to be often said that Task Manager does not provide an accurate indication of how much memory is in use by a process. If this is indeed the case, what's the easiest way to find these things out? I'd like to know: Total Memory in use (whether in RAM or paged or whatever) Total RAM in use (running in a situation where the mach...

Java 6 Excessive Memory Usage

Does Java 6 consume more memory than you expect for largish applications? I have an application I have been developing for years, which has, until now taken about 30-40 MB in my particular test configuration; now with Java 6u10 and 11 it is taking several hundred while active. It bounces around a lot, anywhere between 50M and 200M, and...

How can a program have a high virtual byte count while the private bytes are relatively low on Windows 32-bit?

I'm trying to get a better understanding of how Windows, 32-bit, calculates the virtual bytes for a program. I am under the impression that Virtual Bytes (VB) are the measure of how much of the user address space is being used, while the Private Bytes (PB) are the measure of actual committed and reserved memory on the system. In particu...

Measuring memory use of device drivers in Windows

How can I determine how much memory each device driver is consuming? I'm assuming this can be done with some Win32 or .NET API, but I just haven't been able to determine which. ...

What is a suitable replacement for the SQL Like operator to increase performance?

I'm working on an application that runs on Windows Mobile 6 that needs to be able to retrieve all items from an item table that contain a given string (provided by the end user) within the item's description field. The problem is that there are approximately 170,000 items in the table. Since I need to return all items that contain the st...

How are objects stored in memory in C++?

How are objects stored in memory in C++? For a regular class such as class Object { public: int i1; int i2; char i3; int i4; private: }; Using a pointer of Object as an array can be used to access i1 as follows? ((Object*)&myObject)[0] === i1? Other questions on SO seem to suggest that casting a struct to ...

Avoiding array duplication

According to MSDN: Array usage guidelines: Array Valued Properties You should use collections to avoid code inefficiencies. In the following code example, each call to the myObj property creates a copy of the array. As a result, 2n+1 copies of the array will be created in the following loop. [Visual Basic] Dim i As Integer For i...

Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php

Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php any suggestion ...

What is the memory overhead of storing data in a .NET DataTable?

I'm trying to get a handle on the amount of memory overhead associated with a .NET DataTable, and with individual DataRows within a table. In other words, how much more memory does a data table occupy than what would be needed simply to store a properly typed array of each column of data? I guess there will be some basic table overhead, ...

How to get the Memory Used by a Delphi Program.

I know how to get the System memory use using GlobalMemoryStatusEx, but that tells me the what the entire OS is using. I really want my program to report how much memory it alone has allocated and is using. Is there any way within my Delphi 2009 program to call either a Windows function or maybe some FastMM function to find out the me...

How to track memory allocations in C++ (especially new/delete)

How can I track the memory allocations in C++, especially those done by new/delete. For an object, I can easily override the operator new, but I'm not sure how to globally override all allocations so they go through my custom new/delete. This should be not a big problem, but I'm not sure how this is supposed to be done (#define new MY_NE...

How to reduce memory usage in a Haskell app?

I am new to functional programming, and now learn Haskell. As an exercise I decided to implement the explicit Euler method for 1D linear diffusion equation. While the code below works correctly, I am not happy about its performance. In fact, I am concerned with memory consumption. I believe that it is related to lazy evaluation, but cann...

Is there a way to retrieve a C# app's current memory usage?

I am automating some profiling tasks and want to log heap space and generation sizes real-time. The profiling API seems awfully complicated for what I need, and it seems to listen in on individual allocations and collections, which isn't that important to me. Profiling tools are a great help of course, but I was looking for a more flex...