memory

Profile memory-performance for part of an rails project

I want to test the profile usage of an important library-class of my rails-project. It uses ActiveRecord so I need all rails dependencies to profile it. As far as I know, I need a patched ruby (rubygc) so script/profile and script/benchmark can track memory usage. I tried to follow this official guide to patch the source code of ruby 1....

threading problem (EXC_BAD_ACCESS)

Hi all, the following code crashes the application, and I don't know why. It crashes irregularly, that means that sometimes the imageview can be shown for example 30 times when a row is clicked, sometimes it chrashes the second time when I select a row. FYI: the activity indicator,the action sheet and the variable imageNr are defined g...

Display image from memory using file upload

So I'm working on a site that is going to need a file upload control where the user would be able to upload an image, and then the page would postback causing the image to appear for their viewing (before they submit the data to the database, the image is being stored as type image). What I do now is have my own private web form where p...

Memory assignment of local variables

void function(int a, int b, int c) { char buffer1[5]; char buffer2[10]; } We must remember that memory can only be addressed in multiples of the word size. A word in our case is 4 bytes, or 32 bits. So our 5 byte buffer is really going to take 8 bytes (2 words) of memory, and our 10 byte buffer is going to take 1...

Why does it NOT give a segmentation violation?

The code below is said to give a segmentation violation: #include <stdio.h> #include <string.h> void function(char *str) { char buffer[16]; strcpy(buffer,str); } int main() { char large_string[256]; int i; for( i = 0; i < 255; i++) large_string[i] = 'A'; function(large_string); return 1; } It's compiled and ...

2 Files, Half the Content, vs. 1 File, Twice the Content, Which is Greater?

If I have 2 files each with this: "Hello World" (x 1000) Does that take up more space than 1 file with this: "Hello World" (x 2000) What are the drawbacks of dividing content into multiple smaller files (assuming there's reason to divide them into more files, not like this example)? Update: I'm using a Macbook Pro, 10.5. B...

Java: Reading images and displaying as an ImageIcon

I'm writing an application which reads and displays images as ImageIcons (within a JLabel), the application needs to be able to support jpegs and bitmaps. For jpegs I find that passing the filename directly to the ImageIcon constructor works fine (even for displaying two large jpegs), however if I use ImageIO.read to get the image and ...

OutOfMemoryException Processing Large File

We are loading a large flat file into BizTalk Server 2006 (Original release, not R2) - about 125 MB. We run a map against it and then take each row and make a call out to a stored procedure. We receive the OutOfMemoryException during orchestration processing, the Windows Service restarts, uses full 2 GB memory, and crashes again. The ...

What is the exact difference between MEM_RESERVE and MEM_COMMIT states?

As I understand it MEM_RESERVE is actually 'free' memory, ie available to be used by my process, but just hasn't been allocated yet? Or it was previously allocated, but had since been freed? Specifically, see in my !address output below how I am nearly out of virtual address space (99900 KB free, 2307872 as MEM_PRIVATE. But the sta...

Better way of looping to detect change.

As of now I'm using a while(true) method to detect changes in memory. The problem with this is it's kill the applications performance. I have a list of 30 pointers that need checked as rapidly as possible for changes, without sacrificing a huge performance loss. Anyone have ideas on this? EDIT** The idea of this is to detect changed in ...

Boost Unit testing memory reuse causing tests that should fail to pass

We have started using the boost unit testing library for a large existing code base, and I have run into some trouble with unit tests incorrectly passing, seemingly due to the reuse of memory on the stack. Here is my situation: BOOST_AUTO_TEST_CASE(test_select_base_instantiation_default) { SelectBase selectBase(); BOOST_CHEC...

Can memory be leaked when using vector of pointer in c++?

I tried this: .... vector<players*> player; for (int i = 0; i<10; i++) { player.push_back(new players()); } ... And I wonder if I need to free memory for the vector? If so, how? ...

Acordex Image viewer throws out of memory exception in CITRIX environment

We have a .net 2.0 application. In the .aspx page we are calling the java applet using . This applet is calling the Acordex Image viewer. In the production environment users are facing "out of memory" or "insufficient memory" issues when users try to open the image or magnify an image in Acordex viewer. Strangely when the users logout an...

Problem with memory leaks

Sorry, having difficulty formattin code to appear correct here??? I am trying to understand the readings I get from running instruments on my app which are telling me I am leaking memory. There are a number, quite a few in fact, that get reported from inside the Foundation, AVFoundation CoreGraphics etc that I assume I have no contr...

Benchmarks used to test a C and C++ allocator?

Please kindly advise on benchmarks used to test a C and C++ allocator? Benchmarks satisfying any of the following aspects are considered: Speed Fragmentation Concurrency Thanks! ...

Netbeans Clamshell emulator out of memory

Hello, I have been working with the clamshell mobile phone emulator for netbeans. I recently have tested a simple bluetooth application and got an Out of Memory erorr. Is it possible to up the amount of memory the emulator can use? thanks! ...

CUDA: Memory copy to GPU 1 is slower in multi-GPU

My company has a setup of two GTX 295, so a total of 4 GPUs in a server, and we have several servers. We GPU 1 specifically was slow, in comparison to GPU 0, 2 and 3 so I wrote a little speed test to help find the cause of the problem. //#include <stdio.h> //#include <stdlib.h> //#include <cuda_runtime.h> #include <iostream> #include <f...

pointers in structs a memory leak?

I couldn't find any mention of this online... wouldn't putting a pointer in a struct be a bad thing? (at least in the modern object oriented programing) The programmer would inevitably creating a memory leak correct? (unless they, every time they use it, they disassociate the memory every time) Assuming that the above is correct... is i...

Ruby: execute a binary file in memory?

Is it possible to read binary in ruby file and execute it directly in memory? for example something like this: x = IO.read('/bin/ls') execute(x) I tried system(x) but it gives: ArgumentError: string contains null byte ...

How are two-dimensional arrays formatted in memory?

In C, I know I can dynamically allocate a two-dimensional array on the heap using the following code: int** someNumbers = malloc(arrayRows*sizeof(int*)); for (i = 0; i < arrayRows; i++) { someNumbers[i] = malloc(arrayColumns*sizeof(int)); } Clearly, this actually creates a one-dimensional array of pointers to a bunch of separate ...