To illustrate the problem, here is a simplified version of my setup.
I have a factory like this one :
public interface IFactory{ }
public class Factory : IFactory
{
public Factory()
{
Console.WriteLine("parameterless");
}
//public Factory(int i)
//{
// Console.WriteLine("with parameter : {0}", i);
...
Hi,
When a MarshalByRef object is passed from an AppDomain (1) to another (2), if you wait 6 mins before calling a method on it in the second AppDomain (2) you will get a RemotingException :
System.Runtime.Remoting.RemotingException:
Object [...] has been disconnected or
does not exist at the server.
Some documentation about t...
I have an ActiveX control written in C++ that runs in Internet Explorer 8. Most of the time (approx 90%) when the tab or browser containing the control is closed, there is an access violation like this:
The thread 'Win32 Thread' (0x1bf0) has exited with code 0 (0x0).
Unhandled exception at 0x77b3b9fd in iexplore.exe: 0xC0000005: Access ...
This question is about dealing with unmanaged resources (COM interop) and making sure there won't be any resource leaks. I'd appreciate feedback on whether I seem to do things the right way.
Background:
Let's say I've got two classes:
A class LimitedComResource which is a wrapper around a COM object (received via some API). There ...
I am currently building my own toy vector for fun, and I was wondering if there is something like the following in the current or next standard or in Boost?
template<class T>
void destruct(T* begin, T* end)
{
while (begin != end)
{
begin -> ~T();
++begin;
}
}
template<class T>
T* copy_construct(T* begin, T* ...
We're using Unity to provide dependency injection within the WCF service layer for our current project, and we have followed examples such as the following to write a service host factory, service host, service behaviour and instance provider:
http://avingtonsolutions.com/blog/post/2008/08/02/Uisng-Unity-with-a-WCF-Service.aspx
The sol...
Hi,
I sometimes use braces to isolate a block of code to avoid using by mistake a variable later. For example, when I put several SqlCommands in the same method, I frequently copy-paste blocks of code, ending by mixing the names and executing twice some commands. Adding braces helps to avoid this situation, because using a wrong SqlComm...
What are the lifetimes of Qt Objects?
Such as:
QTcpSocket *socket=new QTcpSocket();
When socket will be destroyed? Should I use
delete socket;
Is there any difference with:
QTcpSocket socket;
I couldn't find deep infromation about this, any comment or link is welcomed.
...
I need a way to track instances of various classes, without those classes having any knowledge that they are being tracked. Essentially, I have a class factory which creates instances and hands them off to another thread. Once that thread completes and unloads the instance, I need to get notified of that so I can do reference counting an...
I have a lookup table (LUT) of thousands integers that I use on a fair amount of requests to compute stuff based on what was fetched from database.
If I simply create a standard singleton to hold the LUT, is it automatically persisted between requests or do I specifically need to push it to the Application state?
If they are automatica...
Q. Is there a way to find out if an object has any "strong references" to it?
Raymond Chen hinted that a solution might be possible:
You want to know whether the reference
count is zero or nonzero. For that,
use WeakReference.
Notes
i have a "weak reference" to the object (using a WeakReference). If i had a strong referenc...
Note: Object Lifetime RAII not using/with block scope RAII
It seems like its possible using an extra gc category, short lived objects(check gc category somewhat frequently), long lived objects(check gc category less frequently), and resource objects(check gc category very frequently). Or possibly with an extra reference counting gc for ...
Suppose I have a code as follows:
int Main()
{
if (true)
{
new Thread(()=>
{
doSomeLengthyOperation();
}).Start();
}
while (true)
{
//do nothing
}
}
There are 2 threads, I'm going to call the Main thread the thread that is executing the Main() function, and the th...
In what order are objects in a .vbs destroyed?
That is, given these globals:
Set x = New Xxx
Set y = New Yyy
I'm interested in answers to any of the following.
For instances of classes implemented in the .VBS, in what order will Class_Terminate be called? Cursory poking suggests in the order (not reverse order!) of creation, but is...
Say I have a simple WCF application that the client calls in order to get a number. There's not much processing in it and the service contract is attributed as SessionMode=SessionMode.NotAllowed.
When is the constructor called? When is the object destructed? Is a constructor called per request?
Are there any reference documents or reso...