Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

SharpDX.DXGI.Adapter does not properly dispose of Outputs #301

Closed
JranZu opened this issue Mar 7, 2014 · 1 comment
Closed

SharpDX.DXGI.Adapter does not properly dispose of Outputs #301

JranZu opened this issue Mar 7, 2014 · 1 comment

Comments

@JranZu
Copy link

JranZu commented Mar 7, 2014

If you use Outputs[n] to get an output from an Adapter it loads up all of the Outputs but does not dispose of them. If you use the GetOutput(n) (which is obsolete) this issue does not occur.

Looking at the code the outputs are also regenerated to a method level list on each call to Outputs[n] where GetOutput(n) uses different code to achieve this result so perhaps implementing the GetOutput code would be more efficient.

@xoofx
Copy link
Member

xoofx commented Mar 15, 2014

This is somewhat by design. All returned properties in SharpDX that are ComObject must be disposed explicitly by the client (there are very few exceptions, but mostly). Meaning that when you are using:

var outputs = adapter.Outputs;

// process outputs
// store them...etc.
{ ... }

// later
foreach(var output in outputs)
   output.Dispose()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants