Windows error 0x000000A7, 167

Detailed Error Information


MessageUnable to lock a region of a file.
Declared inwinerror.h

This appears to be a raw Win32 error. More information may be available in error 0x800700A7.


This is a Blue Screen of Death stop code. More information is available in the Knowledge Base article Bug Check 0xA7: BAD_EXHANDLE.

HRESULT analysis[3]

This is probably not the correct interpretation of this error. The Win32 error above is more likely to indicate the actual problem.

This code indicates success, rather than an error. This may not be the correct interpretation of this code, or possibly the program is handling errors incorrectly.

Reserved (R)false
Reserved (X)false
FacilityCode0 (0x000)
DescriptionThe default facility code.[3][1]
Error Code167 (0x00a7)

Possible solutions


How to optimize the php process memory usage?


I'll summarize what Lisa did to find the problem:

  • Check the memory layout of a single PHP process with pmap -d <pid>. The output showed that there's a huge amount of shared memory used by the process:
00002b3772850000 2097152 rw-s- 0000000000000000 000:00009   [ shmid=0x2d1b803a ]
  • Examine the shared memory regions with ipcs -m. It showed that there are a lot of shared memory regions created by user nobody (the web server), here are just a few of them:
0x00000000 117964807 nobody 600 2147483648 1 dest 
0x00000000 117997576 nobody 600 2147483648 1 dest 
0x00000000 118030345 nobody 600 2147483648 1 dest
0x00000000 118063114 nobody 600 2147483648 1 dest
  • Disable eAccelerator in php.ini and remove the created shared memory regions:

for i in `ipcs -m | cut -d' ' -f2 | grep '^[0-9]'`; do ipcrm -m $i; done

answered on Stack Overflow Apr 27, 2012 by strkol

How to optimize the php process memory usage?


Rasmus Lerdorf did a conference about PHP performance at Confoo in 2010 and he used a Wordpress blog as an example, this should give you great tools to answer your question:

To sum up:

  • Run a phpinfo() and disable PHP extensions that you don't use. They can take a lot of memory (imagick, curl, ...)
  • Generate a graph of your includes using the extension. You might load useless functions in your wordpress setup.
  • Run benchmarks with siege. Sometimes, tiny optimisations have great impact on performance, so make sure you have metrics, to help you make your decisions.
  • Use callgrind to show where you're loosing performance. In one of my project I was using md5() to hash my SQL queries and cache them. The md5() calls where using 20% of the CPU time.

I would definitely start by disabling PHP extensions if possible.

answered on Stack Overflow Apr 27, 2012 by Tchoupi

How do I look up the particular bits or digits of a hex value in HTML5 / javascript?


The common Bit-Operators (| & >> << etc.) are also available in JavaScript.

Lets assume that you always want two hexadecimal digits from the hexadecimal representation of that integer. And lets count the index of those digits from the right rather than from the left:

function GetHex(hex, offset) {
    // Move the two hex-digits to the very right (1 hex = 4 bit)
    var aligned = hex >> (4 * offset);

    // Strip away the stuff that might still be to the left of the
    // targeted bits:
    var stripped = aligned & 0xFF;

    // Transform the integer to a string (in hex representation)
    var result = stripped.toString(16);

    // Add an extra zero to ensure that the result will always be two chars long
    if (result.length < 2) {
        result = "0" + result;

    // Return as uppercase, for cosmetic reasons
    return result.toUpperCase();


var LAST_DIGITS = 0x000000A7;
var MID_DIGITS = 0x00000E00;

var a = GetHex(LAST_DIGITS, 0);
var b = GetHex(MID_DIGITS, 2); // offset of 2 hex-digits, looking from the right
answered on Stack Overflow Aug 8, 2012 by Niko

Different results between step debugging and running program on tiva c


Your WriteRegister and ReadRegister functions do not follow the flowcharts defined in the TM4C123G data sheet. Apart from not checking or handling the MCS ERROR flag, Figure 16-10 Master TRANSMIT of Multiple Data Bytes shows that when writing the MCS register, you should assert specific bits, while you are writing to all bits, You should instead perform a read-modify-write:

I2C0_MCS_R = 0x00000003; //burst send ( multiple bytes send ) 

should be:

// I2CMCS = ---0-011
uint32_t mcs = I2C0_MCS_R ;
msc &= ~0x00000014; // ---0-0-- 
mcs |= 0x00000003;  // ------11
I2C0_MCS_R = mcs ;

And similarly:

I2C0_MCS_R = 0x00000005; // transmit followed by stop state 

should be

// I2CMCS = ---0-101
mcs = I2C0_MCS_R ;
mcs &= ~0x00000012; // ---0--0- 
mcs |= 0x00000005;  // -----1-1
I2C0_MCS_R = mcs ;

enter image description here

ReadRegister() has a similar issue (although it is unlikely to be an issue in this case):

I2C0_MCS_R = 0x00000007; //stop start run

should strictly be:

// I2CMCS = ---00111
uint32_t mcs = I2C0_MCS_R ;
mcs &= ~0x00000018; // ---00--- 
mcs |= 0x00000007;  // -----111
I2C0_MCS_R = mcs ;

The datasheet recommends for bits 31:5:

Software should not rely on the value of a reserved bit. To provide compatibility with future products, the value of a reserved bit should be preserved across a read-modify-write operation.

The above code does that, but in practice should not be necessary on this specific product, but is good practice in any case.

enter image description here

In any event you should add the recommended error handling code. It may be that no error flag is being set, but we don't know that unless you check for it, and doing so will at least assist debugging - rather then stepping the code, you can simply set a break-point on the error handling and then run at full-speed. This will narrow down the number of possibilities.

answered on Stack Overflow Feb 12, 2017 by Clifford • edited Feb 12, 2017 by Clifford

Different results between step debugging and running program on tiva c


as @Clifford had explained that i should follow the flow charts and although his answer is completely correct it didn't give me any results (previously gave values in case of stepping into the function gave zeroes afterwards) but , i noticed something in the flow charts that i hadn't noticed before which contradicts with the initialization and configuration section in the data sheet

initialization and configuration from the datasheet

now as it says in step 11 that you should be polling the bus busy bit in the MCS register but this is wrong and contradicts with the flow charts , the flow charts are more correct as u should check if the bus is busy before sending anything and then check for the master busy bit before reading from the MDR register or moving on to execute and further steps

basically the correct steps in the initialization and configuration should be : before step 10 poll the bus busy bit in case any other master is sending which can be omitted in case of a single master

after step 10 poll the busy bit before reading or going to any further step to conclude whether the sending has been completed and the master is idle or not

i'm sorry i feel like a complete idiot now for not reading the flow charts carefully but i followed another part which is the initialization and configuration part accepting a fact which wasn't there that both should imply the same thing .

i also found that it works correctly in the tivaware API following the flow charts and not that other section in the datasheet however i didn't want to use the Tivaware API as i am looking forward for problems like this which lead to a better understanding of how things work

thanks again for your help @Clifford cheers!

answered on Stack Overflow Feb 12, 2017 by Essam Eid

How to create production image for NAND flash?


As a previous commenter stated, you're going to have issues with bad blocks since bad block counts and locations are not consistent between devices. But if you skip bad blocks on the dumps, any bad blocks in mtd0-mtd3 will result in partition boundary mismatch. The nand write command probably does not utilize knowledge of the partition layout, so bad blocks in the first four partitions of the device in manufacturing will also result in a misalignment. I think the best option is to flash the five partitions separately.

answered on Stack Overflow Jul 31, 2013 by jimbr

WinDbg with dump files when you have a classic ASP app which uses a lot of .Net via interop


You need to find the roots that holds these strings in memory. I have a few examples in my article: but generally what you might need to do is to use !gcroot command - it should traverse object graph to one of the roots that holds this object.

answered on Stack Overflow Jun 19, 2014 by Alex Netkachov

WinDbg with dump files when you have a classic ASP app which uses a lot of .Net via interop


There are two different heap types: native heaps (heaps of the heap manager) and managed heaps (heaps created by the .NET runtime). What you see as the output of !dumpheap is only the managed part. Since your COM objects are also using native memory, this is not included in the output.

To see the native part of the memory, try !address -summary. .NET memory will show up as <unknown> and native memory will be listed as Heap in the usage summary.

Still, !dumpheap can be helpful, e.g. to see the number of RCW objects created by your application. RCWs are not very large, therefore they might not be listed near the end of the output. Try !dumpheap -stat -type Interop to find them (if you`re using the default interop assembly).

If you know how large your COM objects are on native side, you can just multiply the number of object by the memory usage. In my typical environment, I'm using different COM objects with 5 MB to 100 MB in size, so even a few ones can cause OutOfMemoryException.

Knowing the exact size of a COM object is good for the use of GC.AddMemoryPressure which you can then use.

answered on Stack Overflow Jun 19, 2014 by Thomas Weller



Try replacing your JVM to 1.6 not 1.7.

answered on Stack Overflow Jan 5, 2013 by Archer


Leave a comment

(plain text only)


  1. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0