GithubHelp home page GithubHelp logo

Comments (3)

D4n1aLLL avatar D4n1aLLL commented on July 28, 2024

#27

I was able to solve the issue.

The issue is not related to NetBarcode, System.Drawing.Common (atleast on windows). On linux environment we use libgdiplus.
NetBarcode.Barcode.GetImage() creates a bitmap:

var bitmap = new Bitmap(_width, _height);

This by default creates a bitmap having 32bit depth (RGBA).

public Bitmap(int width, int height) : this(width, height, PixelFormat.Format32bppArgb)
{
}

I suspect on Linux GDI+ is no properly handling 32bit color images.
If you explicitly specify bitmap to use 24Bit:

var bitmap = new Bitmap(_width, _height, PixelFormat.Format24bppRgb);

The memory leak issue will be fixed.

from netbarcode.

Tagliatti avatar Tagliatti commented on July 28, 2024

Thanks for the contribution. Could you post the memory diagnostics in version 1.4.5?

from netbarcode.

D4n1aLLL avatar D4n1aLLL commented on July 28, 2024

Thanks for the contribution. Could you post the memory diagnostics in version 1.4.5?

Currently on version 1.4.5 the memory usage is at 50ish MB. This can further be increased (a bit only) by disposing Font & FontFamily Barcode.cs:55.

Also for future versions of .NET (6 and above) I would recommend switching to SkiaSharp or ImageSharp (SkiaSharp is faster compared to ImageSharp) as Microsoft has restricted System.Drawing.Common to Windows only in .NET 6.

image

image

from netbarcode.

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.