| How does non-deterministic garbage collection affect my code? |
| For most programmers, having a garbage collector (and using garbage collected objects) means that you never have to worry about deallocating memory, or reference counting objects, even if you use sophisticated data structures. It does require some changes in coding style, however, if you typically deallocate system resources (file handles, locks, and so forth) in the same block of code that releases the memory for an object. With a garbage collected object you should provide a method that releases the system resources deterministically (that is, under your program control) and let the garbage collector release the memory when it compacts the working set. |
|
|
|
|
|
| Can I avoid using the garbage collected heap? |
| All languages that target the runtime allow you to allocate class objects from the garbage-collected heap. This brings benefits in terms of fast allocation, and avoids the need for programmers to work out when they should explicitly free each object.
The CLR also provides what are called ValueTypes—these are like classes, except that ValueType objects are allocated on the runtime stack (rather than the heap), and therefore reclaimed automatically when your code exits the procedure in which they are defined. This is how "structs" in C# operate.
Managed Extensions to C++ lets you choose where class objects are allocated. If declared as managed Classes, with the __gc keyword, then they are allocated from the garbage-collected heap. If they dont include the __gc keyword, they behave like regular C++ objects, allocated from the C++ heap, and freed explicitly with the "free" method. |
|
|
|
|
|
| How do you debug an ASP.Net Web application? |
| Attach the aspnet_wp.exe process to the DbgClr debugger. |
|
|
|
|
|
| How can you automatically generate interface for the remotable object in ASP.Net with Microsoft tools? |
| Use the Soapsuds tool. |
|
|
|
|
|
| What is "Validation of viewstate MAC failed" error? |
| You can get this Exception, when the following preconditions are true:
1. You are not using a web farm.
2. It appears when using built-in databound controls such as GridView, DetailsView or FormView which utilize “DataKeyNames”.
3. It appears if you have a large page which loads slowly for any reason.
If following preconditions are true and you click a postbacking control/link and the page has not loaded completely in client browser, you might get the "Validation of ViewState MAC failed" exception.
When this happens, if you just try setting the page property "EnableViewStateMac" to false, it does not solve the problem, it just changes the error message in same navigation behavior. |
|
|
|
|
|
| How can you automatically generate interface for the remotable object in ASP.Net with Microsoft tools? |
| Use the Soapsuds tool. |
|
|
|
|
|
| Why bother with two schemes of memory management - By Value Type & By Reference Type? |
| Stacks are limited in the size in which they can grow - only a finite memory can be consumed by a single stack (1MB is the default under Win32). Heaps can grow until all memory available to an application is exhausted. |
|
|
|
|
|
|