memory-allocation

One large malloc versus multiple smaller reallocs

Hello. Sorry if this has been asked before, I haven't been able to find just what I am looking for. I am reading fields from a list and writing them to a block of memory. I could Walk the whole list, find the total needed size, do one malloc and THEN walk the list again and copy each field; Walk the whole list and realloc the block of...

placement new + array +alignment

SomeObj<unsigned int>* Buffer; char* BufferPtr = MemoryManager::giveMeSomeBytes(resX*resY*sizeof(SomeObj<unsigned int>)); Buffer = new(BufferPtr) SomeObj<unsigned int>[resX*resY]; when I step past these lines with the debugger, it shows me the values for the variables Buffer and BufferPtr: BufferPtr: 0x0d7f004c Buffer: 0x0d7f0050 ...

Is it possible to allocate a certain sector of RAM under Linux?

I have recently gotten a faulty RAM and despite already finding out this I would like to try a much easier concept - write a program that would allocate faulty regions of RAM and never release them. It might not work well if they get allocated before the program runs, but it'd be much easier to reboot on failure than to build a kernel wi...

Received memory warning

I am working on an app with xml parser, uiwebview, navigationcontroller, displaying a lot of images on the main controller, that remains in the memory throughout the whole life of the app. I store my data using core data. I tried to figure out the memory footprint of the application since I am getting the following warnings: Received me...

How much memory is allocated for one Integer object in Java? How to find out this value for any custom object?

What is the proper way to measure how much memory from the heap should be used to create new object of a certain type (let's talk about Integers to keep it simple)? Can this value be calculated without experiment? What are the rules in that case? Are these rules strictly specified somewhere or they can vary from jvm to jvm? ...

confusing memory allocation error on iPhone

Hello I'm working on an iPhone application which provides information with images and texts. In every text there is one image, which can be clicked and zoomed, shown with a UIImageView NSString* imgName = [imgPath substringToIndex:[imgPath rangeOfString:@".jpg"].location]; UIImage* img = [UIImage imageWithContentsOfFile:[[NSBundle m...

iphone/ipad troubleshooting device crashes due to memory

I have an app that often crashes on the device (iPad), but not on the simulator, so any simulator debug tactics (MallocStackLogging for example) are not an option. What I usually get in the console is this: Received memory warning. Level=1 Received memory warning. Level=2 Program received signal: “0”. Data Formatters temporarily unavai...

Data from TouchJSON getting deallocated

I have an NSArray stored as a property of my class with a retain attribute. I use a NSURLConnection to return me data as JSON. I use TouchJSON to convert it into a NSDictionary object which I store into the array. I'm using this array as the datasource for a UITableView, but after scrolling through the table a few times I get a messag...

Symfony : Generating filter+form classes = Fatal error (Allowed memory size exhausted)

Hello, I've got this weird error when i try to generate either the filters or the form on my production server. Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 20 bytes) in /var/www/project/lib/vendor/symfony/ lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php on line 669 I don'...