memory-management

WPF Memory Usage

Application: WPF Application consisting of a textbox on top and a listbox below Users type a string in the TextBox to find employees, and search results are displayed in the ListBox ListBox uses DataTemplates to display elements (shows employee name, department, phone and a thumbnail picture.) Implementation: At application startu...

Memory-related crash with adding objects to NSArrayController

I'm writing a simple ObjC2.0/Cocoa application, and I'm getting a crash.. Not being familiar with Cocoa or ObjC, I can't work out why.. The code causing the problems is TableListCon.m When I drag a folder onto the NSTableView, it calls addDirectoryToList - which recursively loops over all files contained in this directory, calling addF...

Reusing a NSString variable - does it cause a memory leak?

Coming from a .NET background I'm use to reusing string variables for storage, so is the code below likely to cause a memory leak? The code is targeting the iphone/itouch so no automatic GC. -(NSString*) stringExample { NSString *result = @"example"; result = [result stringByAppendingString:@" test"]; // where does "example" go?...

How does Cheat O'Matic work?

How does this program access other processes memory? How can it write into the address space of another process? Wasn't it supposed to segfault or something? ...

c++ char array out of scope or not?

I have a method that requires a const char pointer as input (not null terminated). This is a requirement of a library (TinyXML) I'm using in my project. I get the input for this method from a string.c_str() method call. Does this char pointer need to be deleted? The string goes out of scope immediately after the call completes; so th...

What memory management do I need to cleanup when using TinyXml for C++?

I'm doing the following with TinyXml: TiXmlDocument doc; TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" ); TiXmlElement* main = new TiXmlElement("main"); TiXmlElement* header = new TiXmlElement("header"); header->SetAttribute("attribute","somevalue"); main->LinkEndChild(header); // ... Add many more TiXmlElment* to other...

In objective-C (iphone), how do I manage the memory of '@protocol' references?

I thought I had a pretty good handle on memory management for objective-c, but I can't figure out the following situation: @protocol MyProtocol @end @interface MyObject : NSObject { id<MyProtocol> reference; } @property (nonatomic, retain) id<MyProtocol> reference; @end @implementation MyObject @synthesize reference; -(vo...

Java Memory explained (SUN JVM)

I tried to find a interpretation of the memory segments of the sun java vm, which would also understandable by an administrator. It should explain what heap / non-heap memory is and the significance of the different memory pools. If it would somehow relate to the jconsole view, it would be a bonus. Is there somewhere a website with su...

How to resolve 'unrecognized selector sent to instance'?

In the AppDelegate, I'm alloc'ing an instance defined in a static library. This instance has an NSString property set a "copy". When I access the string property on this instance, the app crashes with 'unrecognized selector sent to instance'. Xcode provides a code hint for the property, which means it is known in the calling app. The ...

controllable memory swapping in Java?

Is it possible to prevent Java from swapping out certain objects? This would be relevent if I cache a password inside a client Application for subsequent logins into a remote Service or for decrypting data from the local disk. Unless the user does not encrypt his swap space, the password would appear as clear text in the swap space. I...

Are some allocators lazy?

Hello, I wrote a C program in Linux that mallocs memory, ran it in a loop, and TOP didn't show any memory consumption. then I've done something with that memory, and TOP did show memory consumption. When I malloc, do I really "get memory", or is there a "lazy" memory management, that only gives me the memory if/when I use it? (There...

In C++ Win32 app how can I determine private bytes, working set and virtual size

I'm writing some code for educational purposes and I'd like to be able to print these memory usage values out from a windows console program written in C++. ...

Memory allocation in VC++

I am working with VC++ 2005 I have overloaded the new and delete operators. All is fine. My question is related to some of the magic VC++ is adding to the memory allocation. When I use the C++ call: data = new _T [size]; The return (for example) from the global memory allocation is 071f2ea0 but data is set to 071f2ea4 When overlo...

Memory / Optimization concern

I'm working at a complex script which could be processing upto 500,000 records. Here's my question. Basically my code will parse a text file to get each of those 500,000 or so records. Each record will have a category, my code will need to check if a new record in the categories table had been created for that category during that parti...

In-memory Java database that I can persist (as a single huge blob of memory)

I am looking for an in-memory relational (SQL) database for Java (something like HSQLDB), whose whole state I can serialise. wholeDatabase.serialize(outputStream); newCopyOftheDatabase.loadFrom(inputStream); Or maybe the DB only uses a byte[] that I give it on initialization: byte[] memory = new byte[10 *1024*1024]; new InMemoryDatab...

Contiguous VirtualAlloc behaviour on Windows Mobile

I have been optimising memory performance on a Windows Mobile application and have encountered some differences in behaviour between VirtualAlloc on Win32 and Windows CE. Consider the following test: // Allocate 64k of memory BYTE * a = (BYTE *)VirtualAlloc(0, 65536, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); // Allocate a second contig...

On releasing object belong to another object - xcode memory management

Is [[MyObject itemProperty] release] acceptable? Currently, I have MyObject fetching some data and sets it to itemProperty. The delegate of MyObject then fires off and uses MyObject's itemProperty data and releases it. Is this an acceptable way of memory management? I've been told from various books that you should only release an obje...

VB -- MemoryStream data not released from memory

Is there something that needs to be done with the following code to release the memory it uses? Dim objImage As MemoryStream Dim objwebClient As WebClient Dim sURL As String = Trim(m_StationInterface.PicLocation) objwebClient = New WebClient objImage = New MemoryStream(objwebClient.DownloadData(sURL)) m_imgLiftingEye.Image ...

Are there any good custom allocators for C++ that maximize locality of reference?

I am running a simulation with a lot if bunch of initial memory allocations per object. The simulation has to run as quickly as possible, but the speed of allocation is not important. I am not concerned with deallocation. Ideally, the allocator will place everything in a contiguous block of memory. (I think this is sometimes called a...

With an NSArray of object references, do I explicitly release all objects in the array or just the array itself?

My class has an NSArray that is filled with objects. In my dealloc method, can I simply call release on my NSArray, or do I need to iterate the array and release all objects first? ...