memory

Anatomy of a "Memory Leak"

In .NET perspective: What is a Memory Leak? How to understand whether your application leaks? What are the effects? How to prevent a memory leak? If your application has memory leak, does it go away when the process exits or killed? Or do memory leaks in your application affects other processes on the system even after process completi...

Heap corruption under Win32; how to locate?

I'm working on a multithreaded C++ application that is corrupting the heap. The usual tools to locate this corruption seem to be inapplicable. Old builds (18 months old) of the source code exhibit the same behaviour as the most recent release, so this has been around for a long time and just wasn't noticed; on the downside, source delt...

Setting Objects to Null/Nothing after use in .NET

Should you set all the objects to null (Nothing in VB.NET) once you have finished with them? I understand that in .NET it is essential to dispose of any instances of objects that implement the Idisposable interface to release some resources. Although the object can still be something after it is disposed (hence the isDisposed property ...

Understanding reference counting with Cocoa / Objective C

I'm just beginning to have a look at Objective C and Cocoa with a view to playing with he iPhone SDK. I'm reasonably comfortable with C's malloc and free concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just not over the hump yet. I guess my question is, c...

Of Memory Management, Heap Corruption, and C++

So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based off the fact that I added a std::string to a class and assigning it a value from another std::string: std::string hello = "Hello, world.\n"; /* exampleString = "Hello, world.\n" would work fine. */ exampleStr...

Some kind of task manager for JavaScript in Firefox 3?

Recently I have been having issues with Firefox 3 on Ubuntu Hardy Heron. I will click on a link and it will hang for a while. I don't know if its a bug in Firefox 3 or a page running too much client side JavaScript, but I would like to try and debug it a bit. So, my question is, is there a way to have some kind of process explorer, or...

Best way to wrap rsync progress in a gui?

I use rsync to synchronize files to Windows clients in a server agnostic way. What methods are available to send the progress of rsync to the parent process for display in a gui progress bar? I imagine two or three choices exist. (1) Watch STDOUT (2) Watch rsync.exe log file, similar to unix tail (3) Watch rsync console output in memory...

Secure Memory Allocator in C++

I want to create an allocator which provides memory with the following attributes: cannot be paged to disk. is incredibly hard to access through an attached debugger The idea is that this will contain sensitive information (like licence information) which should be inaccessible to the user. I have done the usual research online a...

Replicating load related crashes in non-production environments

Hi all, We're running a custom application on our intranet and we have found a problem after upgrading it recently where IIS hangs with 100% CPU usage, requiring a reset. Rather than subject users to the hangs, we've rolled back to the previous release while we determine a solution. The first step is to reproduce the problem -- but we...

Reading Other Process' Memory in Mac OS / BSD

I've been attempting to understand how to read the memory of other processes on Mac OS, but I'm not having much luck. I've seen many examples online using ptrace with PEEKDATA and such, however it doesn't have that option on BSD (man page). Does anyone know how I might do this? Thank you. ...

best way to persist data in .NET Web Service

I have a web service that queries data from this json file, but i don't want the web service to have to access the file every time. I'm thinking that maybe i can store the data somewhere else (maybe in memory) so the web service can just get the data from there the next time it's trying to query the same data. I kinda understand what nee...

How to dispose a class in .net?

The .net garbage collector will eventually free up memory, but what if you want that memory back immediately? What code do you need to use in a class myclass to call myclass.dispose and free up all the used space by variables and objects in myclass? ...

Preventing Memory Leaks with Attached Behaviours

Hi guys, I've created an "attached behaviour" in my WPF application which lets me handle the Enter keypress and move to the next control. I call it EnterKeyTraversal.IsEnabled, and you can see the code on my blog here. My main concern now is that I may have a memory leak, since I'm handling the PreviewKeyDown event on UIElements and ne...

Is Visual C++ memory managed by the Dot Net framework

I have recently had an issue accessing MAPI through the dot net framework (explained in this artical) that in turn has generated memory access violation errors. To get around this I opted to use a third party component from code project with a visual C++ core however we still have the problems. I have never used visual C++ myself howe...

memset() causing data abort

I'm getting some strange, intermittent, data aborts (< 5% of the time) in some of my code, when calling memset. The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act. I'm using the following code: char *msg = (char*)malloc(sizeof(char)*2048); char *temp = (char*...

FLVPlayback component memory issues

My website is entirely flash based, it moves around a 3D model which was given to me as chunks of video that I've converted to FLV files. I'm using the FLVPlayback component to control the video inside of my program. While running memory checks using System.totalMemory I've noticed that whenever a video is loaded, it will eat up a chunk ...

How does .net managed memory handle value types inside objects?

public class MyClass { public int Age; public int ID; } public void MyMethod() { MyClass m = new MyClass(); int newID; } To my understanding, the following is true: The reference m lives on the stack and goes out of scope when MyMethod() exits. The value type newID lives on the stack and goes out of scope when MyMet...

C Memory Management

I've always heard that in C you have to really watch how you manage memory. And I'm still beginning to learn C, but thus far, I have not had to do any memory managing related activities at all.. I always imagined having to release variables and do all sorts of ugly things. But this doesn't seem to be the case. Can someone show me (with ...

How Does A Stack Overflow Occur and How Do You Prevent It?

I was just wondering how a stack overflow occurs and the best ways to make sure it doesn't happen, or ways to prevent one - particularly on web servers, but other examples would be interesting, as well. ...

Using MySQLi - which is better for closing queries

I have a habit of keeping my variable usage to a bare minimum. So I'm wondering if there is any advantage to be gained by the following: $query = $mysqli->query('SELECT * FROM `people` ORDER BY `name` ASC LIMIT 0,30'); // Example 1 $query = $query->fetch_assoc(); // Example 2 $query_r = $query->fetch_assoc(); $query->free(); Now if...