Git Product home page Git Product logo

Comments (7)

justinstenning avatar justinstenning commented on July 4, 2024

Can you please try with Png image format, and PixelData to see if they also exhibit the behaviour.

from direct3dhook.

SladeThe avatar SladeThe commented on July 4, 2024

Disabled all my code inside using and re-checked.

Both Bitmap and Png formats cause memory leak. Probably, Png does it slower, but I'm not sure.

PixelData does not. However, I need to improve my code to be able to use it.

from direct3dhook.

justinstenning avatar justinstenning commented on July 4, 2024

Ok thanks, not sure what changed to introduce that, fairly certain it was good for a while. I’ll try to take a look over the next month.

from direct3dhook.

SladeThe avatar SladeThe commented on July 4, 2024

I'm not very experienced in low level graphics programming, but I made some investigations with dotTrace. There is a leak of unmanaged memory allocated in SharpDX.WIC.Bitmap's constructor inside DXHookD3D11.ToStream.

I'll try to fix it by myself and will make a PR in case of success. Otherwise, I hope that my investigation will help you to find the problem and to fix it.

from direct3dhook.

SladeThe avatar SladeThe commented on July 4, 2024

Further investigations show that the converter.Initialize(bitmap, ...) is the cause of memory leak. When this call happens, a bitmap can not Dispose in a right way.

Disabled converter temporarily in my project, but I'm sure you can find a more elegant solution.

from direct3dhook.

justinstenning avatar justinstenning commented on July 4, 2024

@SladeThe yeah, I have missed wrapping the converter in a using clause in a recent update e.g. var converter = new SharpDX.WIC.FormatConverter(wicFactory); becomes:

using (var converter = new SharpDX.WIC.FormatConverter(wicFactory)) 
{
    ...
}

from direct3dhook.

SladeThe avatar SladeThe commented on July 4, 2024

Yes. That helped, thanks. But doesn't really matter.

The following code works fine for me. Both with and without converter.

using (MemoryStream dataStream = new MemoryStream(screenshot.Data)) {
    using (Bitmap bitmap = (Bitmap) Image.FromStream(dataStream)) {

from direct3dhook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.