Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

ThreadPool.BindHandle

I mentioned that we can use ThreadPool.BindHandle to implement asynchronous IO. Here are roughly the steps necessary to make it happen: 1. Create an overlapped file handle SafeFileHandle handle = CreateFile( filename, Win32.GENERIC_READ_ACCESS, Win32.FILE_SHARE_READ
Posted by junfeng | 2 Comments
Filed under:

ThreadPool.UnsafeQueueNativeOverlapped

CLR’s thread pool has two pools of threads. The first pool is used by ThreadPool.QueueUserWorkItem . The second pool is an IoCompletionPort thread pool used by ThreadPool.BindHandle and ThreadPool.UnsafeQueueNativeOverlapped . ThreadPool.BindHandle is
Posted by junfeng | 3 Comments
Filed under:

Conversion between System.String and char *

We can convert a char * to System.String with System.String’s constructor string str = new string((char*)p); And for the reverse: fixed(char *p = str){} Why do we care about conversion between System.String and char *? From this article , this is the
Posted by junfeng | 3 Comments
Filed under:

XXX is not a valid Win32 application

If you have used your Vista SP1-based computer for extended period, you may experience some problems starting large applications, for example, Office 2007 applications. Specifically, you may receive a message “XXX is not a valid Win32 application”. If
Posted by junfeng | 1 Comments
Filed under:

Managed ThreadPool vs Win32 ThreadPool (pre-Vista)

The following is a conversation between me and a CLR dev. The conversation is very informative so I quote it here. From: Sent: To: Subject: RE: ThreadPool.QueueUserWorkItem There might be some confusion here around the meaning of the term "I/O Thread."
Posted by junfeng | 5 Comments
Filed under:

Managed Watson Dump

From .Net Framework 2.0, Dr. Watson is able to generate dump compatible with .Net framework. This means, dumps with heap data generated by Dr. Watson contains information about managed heap so they can be analyzed with sos.dll. Some update to Dr.Watson
Posted by junfeng | 1 Comments
Filed under:

Inspect a 32 bit Process Dump Generated by a 64 bit Debugger

64 bit Windows can run both 32 bit process and 64 bit process. For debugging though, you want to use 32 bit debugger to debug 32 bit process, and 64 bit debugger for 64 bit process. Otherwise it won’t be pretty. Occasionally, I receive a 32 bit process
Posted by junfeng | 2 Comments
Filed under:

Getting a Full Memory Dump for a Process

To diagnose a problem for a remote customer, sometimes the easiest way is to have the customer generate a full memory dump for the process, and share the memory dump. In Vista, task manager can generate a full memory dump from the Processes tab. In Windows
Posted by junfeng | 0 Comments
Filed under:

Event Handles “leak”

On our stress run, we saw our process’ handle count steadily increases until certain point, then it stabilizes. However the number of handles is high. Most of those handles are Event handles. We are concerned about it. So we went off and did some investigation.
Posted by junfeng | 3 Comments
Filed under: ,

Use !htrace to debug handle leak

Windbg Debugger’s !htrace extension is very handy to debug handle leak. The process essentially boils down to the following simple steps: 1. Enable trace 2. Take a snapshot 3. Run scenario 4. Show the diff On step 4, !htrace will show all the extra opened
Posted by junfeng | 3 Comments
Filed under:

Consider Creating a new class for locking

C# provides keyword lock for synchronized access. A good practice is to create a private object for locking purpose. For example, public class LockExample { private object syncObject = new object (); public void SynchronizedMethod() { lock (syncObject)
Posted by junfeng | 5 Comments
Filed under:

A case study of a NullReferenceException

We are seeing a NullReferenceException in our stress program. The investigation process may be helpful to some folks. Thread 22 is showing a Watson dialog. This is a register corruption. 0:022> kp ChildEBP RetAddr 091bc9a0 76961220 ntdll!ZwWaitForSingleObject(void)+0x15
Posted by junfeng | 3 Comments
Filed under: ,

App Config’s root element should be namespace-less

The root element for Application config file is <configuration> <?xml version="1.0" encoding="utf-8" ?> <configuration > </configuration> The application config file is shared with CLR and Windows SxS. SxS dictates
Posted by junfeng | 0 Comments
Filed under: ,

Getting the right exception context from a memory dump

When debug a memory dump, the dump may not in the right exception context when it is first loaded in the debugger. However, we can figure out the right context from the dump. Let's load the dump. c:\debuggers>cdb -z c:\temp\foo.dmp Symbol search path
Posted by junfeng | 1 Comments
Filed under:

Calculating the size of each GC generation

Sos.dll does not have a command to tell the size of each GC generation. However, you can calculate the size based on the output of !eeheap -gc. For example, 0:000> !eeheap -gc Number of GC Heaps: 1 generation 0 starts at 0x1da6c430 generation 1 starts
Posted by junfeng | 2 Comments
Filed under: ,
More Posts Next page »
 
Page view tracker