memory

Accessing a property in NSManagedObject causes memory spike and crash

I am writing an iPhone app which uses core data for storage. All of my NSManagedObject subclasses has been automatically generated by xcode based on my data model. One of these classes looks like this: @interface Client : NSManagedObject { } @property (nonatomic, retain) NSNumber * rate; @property (nonatomic, retain) NSString * name...

The importance of using a 16bit integer

How seriously do developers think about using a 16bit integer when writing code? I've been using 32bit integers ever since I've been programming and I don't really think about using 16bit. Its so easy to declare a 32bit int because its the default for most languages. Whats the upside of using a 16bit integer apart from a little memory ...

Trying to locate a leak! What does anon mean for pmap?

I'm trying to locate where my memory has gone for a java process running in linux. Someone suggested I use pmap -x to see exactly what the memory is doing. The output is really long but basically a good portion of it is a repeat of this: 00007fbf75f6a000 1016 - - - rwx-- [ anon ] 00007fbf76068000 12 ...

How to reclaim the memory used by a Java thread stack?

I've been having this memory leak issue for days and I think I have some clues now. The memory of my java process keeps growing but yet the heap does not increase. I was told that this is possible if I create many threads, because Java threads uses memory outside of the heap. My java process is a server type program so there are 1000-20...

How do you get how much memory a program uses?

I have two programs, one in C++, the other in assembler. I want to compare how much memory they use when running respectively. How can I do this? I am doing the testing on Windows, but I also would like to know how to do it on Linux. ...

How to reduce my flash game's background engine 600MB memory usage peaks?

I'm creating a flash game in actionscript 3 with an infinite universe. Because the universe is infinite the background is created dynamically using the following background engine: BackgroundEngine.as package com.tommedema.background { import br.com.stimuli.loading.BulkLoader; import com.tommedema.utils.Settings; import co...

On a 32bit machine, every memory location is capable of holding 1 byte of data?

for example int = x; because int is 4 bytes they would take up 4 memory locations x x x x ...

Array Size and Addresses in C

When I compiled the following code, it shows that y and the beginning of the array are 60 units apart. But according to my calculation, it should have been 4 * 10 (for the array) + 4 (for k) + 4 (for y) = 48. Also array[12] = 17 was assigned to element 12, since there's no element 12, the implementation should have gone to y and overwri...

How many 'screens' of data could a game store before having to delete some?

Assuming I was making a Temporal-esque time travel game, and wanted a to save the current state of the screen (location of player and enemies, whether or not destructible objects are destroyed, et cetera) every second to an array, how much data would I be able to store on this array before the game would start to lag considerably and I w...

Arranging global/static objects sequentially in memory

In C++, is it possible to force the compiler to arrange a series of global or static objects in a sequential memory position? Or is this the default behavior? For example, if I write… MyClass g_first (“first”); MyClass g_second (“second”); MyClass g_third (“third”); … will these objects occupy a continuous chunk of memory, or is the...

Minimising DirectShow Memory Consumption

Hey, So, I have an application which streams two video sources over a local area connection. Each video has its own filter graph, puts the video through a decoding filter, and an Inifinite Pin Tee filter, and then there is a GMFBridge filter, which is used to turn on/off recording using the WM ASF Filter. There is also a video renderer...

How to zero out memory allocated by Marshal.AllocHGlobal?

I am allocating some unmanaged memory in my application via Marshal.AllocHGlobal. I'm then copying a set of bytes to this location and converting the resulting segment of memory to a struct before freeing the memory again via Marshal.FreeHGlobal. Here's the method: public static T Deserialize<T>(byte[] messageBytes, int start, int len...

How to find the culprit module or script on huge Apache/PHP resident memory usage ?

System: Centos 5.3 x86_64, with Apache 2.2 and PHP 5.2 as module (with mysql and oracle connectors) How to debug memory usage / leaks ? dmalloc ? Valgrind ? auto_prepend_file ? We're looking at 500+ MB VSZ and 50+ MB RSS for example, but it can be somewhat higher. And as the instances add up, we end up needing much more memory than wit...

What are some tools that can analyse memory usage outside of the heap in Java?

We have weird memory leak problem with a Java process running in linux has an ever growing swap usage. So naturally we looked at the heap dump and also used a profiler to monitor it over a period of time. We found that 1) The number of threads does not grow 2) The heap usage does not grow 3) Yet the (VIRT) usage keeps growing (which ca...

sun.misc.Unsafe: How to get the Bytes from an address

Hi! I have heared there is a way to read a value from the memory (as long as the memory is control by the JVM). But how do i get the bytes from the address 8E5203 for example? There is a method called getBytes(long). Can I use this? Thanks a lot! Pete ...

Any concept of shared memory in Java

AFAIK, memory in Java is based on heap from which the memory is allotted to objects dynamically and there is no concept of shared memory. If there is no concept of shared memory, then the communication between Java programs should be time consuming. In C where inter-process communication is quicker via shared memory compared to other mo...

Initialization order with constructors in C++

By instantiating an object in C++ with the following class I get a segmentation fault or aborts, depending on the order declaring member variables. E. g. putting mMemberVar and mAnotherMemberVar after mAnotherCountVar results in a segfault. From this listing I removed a std::ofstream from the member variables, which caused the segmentati...

Openfire Java Memory

Hi, I have openfire installed on my debian server. I want to know that whether openfire java memory should be less than server memory? For e.g. i have a server with 256 MB RAM now can i have openfire java memory more than 256 MB RAM or it should be less than 256. Please help Thanks, Pankaj ...

The right way to manage a big matrix in Java

I'm working with a big matrix (not sparse), it contains about 10^10 double. Of course I cannot keep it in memory, and I need just 1 row at time. I thought to split it in files, every file 1 row (it requires a lot of files) and just read a file every time I need a row. do you know any more efficient way? ...

How to set the maximum memory usage for JVM?

I want to limit the maximum memory used by the JVM. Note, this is not just the heap, I want to limit the total memory used by this process. ...