memory

Nested STL vector using way too much memory

I have an STL vector My_Partition_Vector of Partition objects, defined as struct Partition // the event log data structure { int key; std::vector<std::vector<char> > partitions; float modularity; }; The actual nested structure of Partition.partitions varies from object to object but in the total number of chars stored in P...

Movie Player Crashes Sometimes in Horizontal Orientation

MPMoviePlayerViewController* moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:myChartlyObj.video_url]]; moviePlayerViewController.view.backgroundColor = moviePlayerViewController.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"st-screen.png...

Should I use string or char[]?

So I want to have a buffer with an array of structs like this: EventItem { tag; // some string or array of characters to describe the value; value; // some integer or something } The value can be anything like int32. What I am concerned about is the tag. If I have an array of these objects, and I make the tag a string, what hap...

Dynamically calculate chunk size for an external merge sort in C#

Hi, I am refactoring an external merge sort in C#. The current implementation uses a fixed chunk size of 50mb. I'd like to query the performance counters and dynamically calculate a good chunk size. I'm just not sure which counters to use? Do I get the total available memory and use a percentage of that or can I find how much is availab...

Keeping an AsyncTask alive in low memory conditions?

I have written a home screen widget as an ImageView, ie. the code generates the whole widget and writes it to RemoteViews as a bitmap. On slower devices with low memory, such as my G1, it can take a couple of seconds to generate the bitmap, and to avoid the dreaded force-close, I moved all the graphics code into an AsyncTask. So far so g...

Crash involving UISearchDisplayController rotating?

My app seems to crash sometimes when I rotate the phone. ViewControllerA has a UISearchDisplayController. ViewControllerA pushes ViewControllerB onto the nav stack. Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x000791d0 __kill + 8 ...

Is it worth using require_once() for memory savings?

I'd like to check if my understanding's correct about require_once(). I have a bunch of functions in file foo.php. Let's say 7/8 out of them are always used, and one of them's rather rare and rather large. I have to keep this function's definition in foo.php. Can you tell me if the following approach achieves anything, and if you think i...

Java collections: What happens when "size" exceeds "int"?

I know that Java collections are very memory-hungry, and did a test myself, proving that 4GB is barely enough to store few millions of Integers into a HashSet. But what if I has "enough" memory? What would happen to Collection.size()? EDIT: Solved: Collection.size() returns Integer.MAX when the integer range is exceeded. New question: ...

PHP ini file and session deletion

Hi, Posted a question about an error I was getting the over day about Memory exceed when handling an image resize. Managed to solve the problem with a local php.ini file and setting [PHP] upload_max_filesize = 5M post_max_size = 5M memory_limit = 64M Now I realised I have a whole new problem :) If I access a php file in the direct...

How to store molecules in memory?

I want to store molecules in memory. These can be simple molecules: Methane (CH4) C-H bond-length: 108.7 pm H-H angle: 109 degrees But also more complex molecules, like paracetamol (C8H9NO2): How can I store molecules in memory, including all bond-lengths and angles? A good idea to store atom-structs in an array? Or is there a be...

Feasability of running MongoDB on Linode 512 VPS?

I've read the MongoDB documentation, and it comes with a warning about 32-bit systems; particularly that they're capped at 2 GB of available RAM for Mongo. So I was wondering if that statement meant anything in regards in running MongoDB in a low memory setting like Linode's 512mb of RAM based VPS. I doubt it matters but with a 64-bit ...

Memory is increasing all the time in navigation based iphone app

Hello I have a navigation based App with 5 ViewControllers. After inspecting the memory allocation with instruments i found out that memory is increasing permanently. The app starts up with 2 MB and after navigating through all 5 Navigationcontrollers it grows up to 10 MB and counting... For every allocated object there is a correspondi...

Is there a memory performance benefit of assigning a function to the prototype in Javascript?

I read that adding functions to an object will chew up more memory then adding functions to the prototype of the object. function Obj() { this.M = function() { // do something }; } var o = new Obj(); The idea was that for every construction of Obj, a new function is created and applied to Obj, thus increasing memory use. For 1000...

Estimate required memory for libGD operation

Before attempting to resize an image in PHP using libGD, I'd like to check if there's enough memory available to do the operation, because an "out of memory" completely kills the PHP process and can't be catched. My idea was that I'd need 4 byte of memory for each pixel (RGBA) in the original and in the new image: // check available me...

Is there a CPU emulator or a way to see how things are created and Destroyed in Memory

Ok, This question is not exactly a programming question but this is what can really make programming more practical and easy to implement. This question is coming out beacuase each-time I write int c=10; or MyClass objMyClass=new MyClass(); I want to see where in the memory the value has been created (Though We can see the address as a...

ANTS Memory Profiler - Which memory should I be looking at?

Hi All, I have a memory issue on my websites and am trying to get to the bottom of it. I have downloaded the 14 day trial of ANTS Memory Profiler and have been playing with it to get a grip of what it's telling me. In the memory options on the timeline, I can see Bytes in All Heaps and Private Bytes etc but I am not sure which ones I sh...

Rave Reports and Intraweb ?

Anyone have an example of using Rave Reports (PDF output) and Intraweb ? (or even WebBroker) in delphi ? I'm assuming you write to a memory stream and then output this to the browser. Any help on Rave Reports/Memory Streams and Intraweb or Webbroker appreciated. ...

How is memory allocated for an ASP.NET website?

Hi All, My website is using a lot of memory and I have downloaded the trial of ANTS Memory Profiler. The site is using XML files to store the the categories and the items that belong in those categories - I then traverse the files (4mb for the categories file and about 800kb for the items file stored on the local machine (web server)) a...

Can't find the memory leak

Hi Everyone, I've got a fairly simple app that has the following in the view the program is mostly in: int currentPageIndex; NSArray *images; NSString *nextImage; IBOutlet UIImageView *firstPage; IBOutlet UIButton *bigButton; In the implementation viewDidLoad, I load the array with a bunch of image file names: images = [NSArr...

In my Android app, every other time I launch my app, it crashes with OutOfMemory Exception

I have an Android app that in the onCreate() method, preloads a lot of graphics. When I test my app on my HTC Aria and launch it, it runs fine. However, if I press the back button to exit my app, and then launch the app again, it crashes with an OutOfMemoryError: bitmap size exceeds VM budget. If I then launch the app for the third ti...