memory

C++ stringstream, string, and char* conversion confusion

My question can be boiled down to, where does the string returned from stringstream.str().c_str() live in memory, and why can't it be assigned to a const char*? This code example will explain it better than I can #include <string> #include <sstream> #include <iostream> using namespace std; int main() { stringstream ss("this is a ...

Persistence scheme & state data for low memory situations (iphone)

What happens to state information held by a class's variable after coming back from a low memory situation? I know that views will get unloaded and then reloaded later but what about some ancillary classes & data held in them that's used by the controller that launched the view? Sample scenario in question: @interface MyCustomControll...

Memory usage of DotNET app

My application (DotNET) runs as a plug-in inside a C++ standalone app that exposes a C++/CLI SDK. It is very easy for my users to generate large amounts of data and I'd like to offer an abort option if the memory consumption of my plug-in + the base application reaches -say- 90% of the legal maximum. How can I measure the total memory ...

"Lucene.net-2.3.2.1” memory leakages problem

Dear All, I am using Lucene.Net-2.3.2.1 in my project. My project also supporting multithreading environment. Lucene Indexing service is working as Windows Service. Problem is when the service is running, it's memory blockage is gradually increasing. So after some hours, it shows a memory of 150 mb in Task Manager where as it start with...

C++: tiny memory leak with std::map

I am writing a custom textfile-data parser (JSON-like) and I have lost many hours trying to find a tiny memory leak in it. I am using VC++2008 and the commands _CrtMemCheckpoint and _CrtDumpMemoryLeaks to check for memory leaks. When I parse any file and then remove it from memory (alongside any other memory claimed), I get a 16 bytes ...

What is the memory footprint of a Nullable<T>

An int (Int32) has a memory footprint of 4 bytes. But what is the memory footprint of: int? i = null; and : int? i = 3; Is this in general or type dependent? ...

Out of memory exception was unhandled

I got an out of memory exception in a photo editor thingy i was making in vb.net. The bitmap image is constantly changing, and I always Dispose() of it after it has been sent off to the other bitmap. Is it being stored in a temp folder and using up all my space on the computer, or what? It always bugs after about 8 bitmaps have been draw...

UIImageWriteToSavedPhotosAlbum showing memory leak with iPhone connected to Instruments

Hi, I'm using version 3.0.1 of the SDK. With the iPhone connected to Instruments I'm getting a memory leak when I call UIImageWriteToSavedPhotosAlbum. Below is my code: NSString *gnTmpStr = [NSString stringWithFormat:@"%d", count]; UIImage *ganTmpImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:gnT...

Media Player MPMediaItemArtwork Memory Leak

Hello, I seem to be getting a memory leak when getting the album artwork for the currently playing item with this code: MPMediaItem *playingItem = self.musicPlayer.nowPlayingItem; MPMediaItemArtwork *artwork = [playingItem valueForProperty:MPMediaItemPropertyArtwork]; I have tried [artwork release]; even though I didn't alloc artwork...

Potential Memory Leak in my wxPython App

I am pretty sure I am suffering from memory leakage, but I havent 100% nailed down how its happening. The application Iv'e written downloads 2 images from a url and queues each set of images, called a transaction, into a queue to be popped off by the user interface and displayed. The images are pretty big, averaging about 2.5MB. So as...

Does removeChildAt() clear up cpu resources?

I am loading/unloading several swfs from one main swf. When I load a new swf I do something like this: contentContainer.addChild(the new swf); //add the new swf contentContainer.swapChildrenAt(0,1); contentContainer.removeChildAt(1); //remove the previous swf My question is, when I removeChildAt(), does the old swf keep "playing" and ...

PHP : Json decoding question

How do i decode whole feed arround 10k item without memory limit of php? i found a code which break the feed to part: http://pastebin.com/m43c3384f how do modify the code to work with the feed below : GAF_update_projects_vertical_callback({"projects":{"count":2,"items":[{"id":502817,"name":"SEO","url":"http:\/\/www.getafreelancer.com\...

Determining memory usage?

I'd like to work out how much RAM is being used by each of my objects inside my current workspace. Is there an easy way to do this? ...

Heap Dump Root Classes

We have production system going into infinite loop of full gc and memory drops form 8 gigs to like 1 MB in just 2 minutes. After taking heap dump it tells me there an is an array of java.lang.Object ([Ljava.lang.Object) with millions of java.lang.String objects having same String taking 99% of heap. But it doesn't tell me which class i...

Programmatically get amount of RAM installed on OS X

I'm working on a machine that has 8 gigs of memory installed and I'm trying to programmatically determine how much memory is installed in the machine. I've already attempted using sysctlbyname() to get the amount of memory installed, however it seems to be limited to returning a signed 32 bit integer. uint64_t total = 0; size_t size = ...

How to do memory analysis of heap allocated objects in an embedded systems?

I'm trying to analyze the memory usage of our systems. We have some singleton objects that are allocated on the heap at start-up. I would like to get the size of those objects. The information has to be there, since the debugger knows how big they are. How can I dump that info out of dwarf2 debugging information? Our compiler is WindRive...

How to reconstruct a data-structure from injected process' memory space?

Dears, I've got this DLL I made. It's injected to another process. Inside the other process, I do a search from it's memory space with the following function: void MyDump(const void *m, unsigned int n) { const char *p = reinterpret_cast(m); for (unsigned int i = 0; i < n; ++i) { // Do something with p[...

PHP - Function inside a Function. Good or bad?

I would like to know if it is a good thing to define a function inside another function in PHP. Isn't it better to define it before the function (and not inside) in terms of performances. ...

Printing Instance ID to NSLog?

In the dealloc method for a class how would I print out the ID (or some other unique identifier) for the instance being deallocated? - (void)dealloc { NSLog(@"_deallocing: ??"); [super dealloc]; } Is this possible? I am just trying to get a little more feedback in the console as an aid to learning. many thanks -gary- ...

Allocation of instance variables?

Can anyone tell me if the NSString instance variable "planetName" needs to be allocated / released by me (as in the example below) or is that done when the class instance is created / allocated? My understanding is that int and float don't need to be, but not sure about NSString & NSArray ... @interface PlanetClass : NSObject { ...