Memory StructureMap删除所有已释放的对象引用,但保留配置
嗨,伙计们 我目前正在尝试为StructureMap实现一些自定义ILifecycles。 根据事件的不同,应将与所有对象关联的生命周期从生命周期中删除Memory StructureMap删除所有已释放的对象引用,但保留配置,memory,structuremap,profile,memory-leaks,lifecycle,Memory,Structuremap,Profile,Memory Leaks,Lifecycle,嗨,伙计们 我目前正在尝试为StructureMap实现一些自定义ILifecycles。 根据事件的不同,应将与所有对象关联的生命周期从生命周期中删除 registry.For(pluginType) .LifecycleIs(_lifecycleManager.GetLifecycle(pluginType, instance.GetType(), lifecycleScope)) .Use(instance); 这是一个对象的注册。
registry.For(pluginType)
.LifecycleIs(_lifecycleManager.GetLifecycle(pluginType, instance.GetType(), lifecycleScope))
.Use(instance);
这是一个对象的注册。
我从我的经理那里得到一个plugintype和concretetype的生命周期,使用范围来确定生命周期
registry.For(pluginType)
.LifecycleIs(_lifecycleManager.GetLifecycle(pluginType, instance.GetType(), lifecycleScope))
.Use(instance);
我正在使用LifecycleManager来保存我的对象的知识,因为我需要检查对象是否已经存在,并且只有当我传递createIfMissing=true时才创建/返回它
// determine if an instance already exists for the plugin type
bool doesInstanceExist = _lifecycleManager.ContainsInstance(pluginType);
if (createIfMissing)
{
// create a new instance or get an already existing one
container = DependencyInjectionContainer.GetInstance<T>();
}
else
{
// only get an existing instance
if (doesInstanceExist)
{
container = DependencyInjectionContainer.GetInstance<T>();
}
}
在对象完成其工作或触发关联事件后,应移除并释放对象实例。
我的问题是,我没有找到一种方法来删除StructureMap.Profile类持有的引用,它们总是挂起
如何删除对对象的所有引用,但保留配置