.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Heap corruption in CFusionArray (SxS)

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :.NET Framework
Hi,I am running into an issue where a reg-free COM usage where we have a COM object A that is CoCreateInstance'ing object B. Object B is a managed class that is decorated with the GuidAttribute -- that guid is supplied in the CoCreateInstance call that A makes.In normal execution, there are no issues noticed. However, when using App Verifier to turn on full pageheap verification, AV detects heap corruption. The stack trace seems to point to CFusionArray as the place where a buffer overrun seems to be taking place. Note that this is an NDP 3.5 app. I ran it on a machine with 3.5 SP1 installed.The following is what I see in WinDbg when this happens:=======================================VERIFIER STOP 00000008: pid 0x1948: Corrupted heap block.  00161000 : Heap handle used in the call. 38226E30 : Heap block involved in the operation. 000001CC : Size of the heap block. 00000000 : Reserved =======================================This verifier stop is not continuable. Process will be terminated when you use the `go' debugger command. ======================================= (1948.1fcc): Break instruction exception - code 80000003 (first chance)eax=1000e848 ebx=1000cd44 ecx=00000001 edx=0012c151 esi=00000000 edi=1000e848eip=7c90120e esp=0012c1e4 ebp=0012c3e8 iopl=0         nv up ei pl nz na po nccs=00

View Complete Post

More Related Resource Links

CLR Inside Out: Profiling the .NET Garbage-Collected Heap


In this article, the authors complete the picture for Garbage Collected (GC) heap related memory issues by providing step-by-step instructions on using the CLR Profiler for .NET GC heap memory investigations.

Subramanian Ramaswamy, Vance Morrison

MSDN Magazine October 2009

CLR Inside Out: Large Object Heap Uncovered


This month CLR Inside Out reveals the secrets behind the Large Object Heap-what's there, when it's released, how the garbage collector handles the objects there.

Maoni Stephens

MSDN Magazine June 2008

SQL Server 2000 DB corruption with sysindexes

Here is the output: Server: Msg 8929, Level 16, State 1, Line 8 Object ID 2: Errors found in text ID 26839948591104 owned by data record identified by RID = (1:1959472:7) id = 469576711 and indid = 1. Server: Msg 8961, Level 16, State 1, Line 8 Table error: Object ID 2. The text, ntext, or image node at page (1:1442767), slot 7, text ID 26847561842688 does not match its reference from page (1:1959472), slot 7. Server: Msg 8980, Level 16, State 1, Line 8 Table error: Object ID 469576711, index ID 1. Index node page (0:0), slot 0 refers to child page (1:230) and previous child (0:0), but they were not encountered. Server: Msg 8906, Level 16, State 1, Line 8 Page (1:1056529) in database ID 8 is allocated in the SGAM (1:1022465) and PFS (1:1051440), but was not allocated in any IAM. PFS flags 'MIXED_EXT ALLOCATED   0_PCT_FULL'. CHECKDB found 1 allocation errors and 0 consistency errors in table '(Object ID -58537307)' (object ID -58537307). CHECKDB found 0 allocation errors and 2 consistency errors in table 'sysindexes' (object ID 2). CHECKDB found 1 allocation errors and 1 consistency errors in table 'Connections' (object ID 469576711). CHECKDB found 2 allocation errors and 3 consistency errors in database 'CompanyDB. Windows Server 2000, Sql Server 2000 Enterprise Edition 8.00.760 I've thought about using SQL recovery tool but since this is pointing to system

Database temporary corruption - DBCC CHECKDB error

I've run into a very strange and frustrating recurring error. I have a Single instance SQL Server 2005 DBMS on Win2K3 Server x86.  The problem occurs with a *single* database on the system, the other databases are unaffected.  We primarily access this database for editing through an Access 2007 data project, though it's accessed (select only) from many places using odbc or oledb. Basically some sort of corruption (or apparent corruption) occurs after a server update and reboot (usually unrelated to the DB software).  After that, the database is fine sometimes, other times it is fine until we try to access it via the ADP.  At that point it becomes inaccesssible by the ADP, though it can still be accessed through all other methods.  Running DBCC CHECKDB (databasename) returns: Msg 211, Level 23, State 51, Line 1 Possible schema corruption. Run DBCC CHECKCATALOG. Running DBCC CHECKCATALOG (databasename) returns no errors. Restarting the database service (from inside SSMS typically) will fix it *eventually* after a few restarts.  I can find no rhyme or reason to the apparent corruption.  I'll be glad to look and post any other log entries that might be relevant.  I should note that the database was originally created way back in SQL Server 7, though it's got no real customizations, triggers, and very few constraints on it.  It's

Analysis Services Server Administrators - Name Corruption


Hello everyone,

I'm using SQL Server 20008 Standard. For reasons we yet don't know, from time to time, server administrator's metadata is lost. Please look at the image below.


I'd like to know if anyone knows why this could be happening, with problem fixing recommendations as well :)



How can you check how much heap memory your objects are using?


Is there a way to check how much heap memory your objects are using??  (during debug mode of course) .  I am using Visual Studio 2005 with C# ASP.net.

Secondly, is there a way to check how much memory session variables are using as well?


OWC11 Corruption Issue


I have tried to follow the issue in this thread which mirrors what I am facing almost exactly - http://social.msdn.microsoft.com/Forums/en/sqltools/thread/025b962e-916b-4a87-a81b-caaffa6bc0ee.


In a nutshell, i can't install SQL 2005 becasue setup fails at the OWC11 step. I can't remove OWC11 becasue the components have been corrupted. I am trying to run the FixIT msi file from Microsoft but get this error -

The installer has encountered
an unexpected error installing this package. This may indicate a
problem with this package. The error code is 2103.

Please help. i'm only trying to create a new named instance and it's taken days so far without result.


Why a Clustered table takes more space than a Heap Table


I'm using SQL Server 2005 buld 3080.

I have a table with no clustered index that return the followings results on sp_spaceused:

Rows: 47841318      Reserved :18015392 KB      Data : 7801184 KB      Index : 2489536 KB      Unused :7724672 KB

Tha data takes about 8 gb and there is a space lost of about 7.5 gb on the 17 gb reserved. I understans that because this is a HEAP table it cannot been defrag when running a rebuild index on it. Then I created a clustered index on that table to release unused space. Here is the new result of the sp_spaceused:

Rows: 47841318      Reserved: 15865744 KB      Data : 13140608 KB      Index: 2725000 KB      Unused: 136 KB

Now we can see that the unused space as been released with the defragmentation.

I don't understand why Data space has almost double it's value. The index size has grown up a little bit due to my new clustered index (Probably to store the root levels of the index). I expected that data remain approximatly the same.

If somebody could explain this I would really appreciate to understand.

SQL Server 2005 rebuild indexes find corruption or cross linked files


Does anyone know if this is a known issue? What do you do when this happens? We had to go to a good backup from 3 days prior.

From the application log it appears there were cross linked files. Is this caused by the OS or Sql Server?

Pat M


PatM Reno

Database Corruption - The Facts Please


Our system


We have over 800 PDA units out in the field, all with SQL Server CE 1.0 and 2.0 installed.  There are four programs on the device that each have their own database.  One program (embedded Visual C++) has an SQL CE 1.0 database, the others (Visual Studio C# CF1) use SQL CE 2.0.


All four databases are stored in a permanent area of memory on the device, but never on the Storage Card.  They are accessed using a connection that is opened and closed for each operation.  We have seen all four databases become corrupted, but the most common is the one most frequently used.


We currently have 10 different PDA models supported by our software out in the field.  We have seen corruption in all of them.




We have poured an enormous amount of resources into trying to work around the problem.  We cannot reproduce corruption at will, but we have collected some facts about it.


1) It does not solely happen because of 'power failure'.  We have seen a database corrupted in our office whilst the device was being charged and powered on the whole time.

2) Removing transactions does not

Passing unmanaged array to a Managed Thread. - memory corruption

I'm a newbie for .Net and trying to use managed threading.
I couldn't find any problem in my code, but it triggers an exception when the Thread Ends.
Something like:
Unhandled exception at 0x5cbf80ea (msvcr90d.dll)
0xC0000005: Access violation reading location 0x000000d7.
#include "stdafx.h"

using namespace System;
using namespace System::Threading;

#define sz 100

//int dt[sz]; //allcating a gloal buffer
int *dt;

void workerThread (void)
	Console::WriteLine("Producer Thread Started!");
	int data = 50;
	for(int i=0; i<sz; i++)
		dt[i] = i;
		Console::WriteLine("Producer W={0}", i);
	Console::WriteLine("Producer Thread Ending");

int main(array<System::St

Safe way of using GetWriteWatch() on managed heap without confusing GC? (using Profiling API)


Hi everyone,

In a current project I'm trying to track memory updates of managed objects on the GC heaps with the assistance of the Profiling API for CLR. My plan is to use the Windows API memory management function GetWriteWatch() to achieve this goal, as I then can get the memory pages written to since the last call (with the WRITE_WATCH_FLAG_RESET flag set). However, I've read that the Garbage Collector also uses this function to track updated references on old objects, so I guess simply resetting this flag would cause disaster.

I’m using the Profiling API to track how the objects are moved on the GC heaps, and my code will look something like this:

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend