question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I put an Image on FRX, Request ‘TestReport’ multiple times,My container footprint is 1GB or higher. Is there a problem with my code?

[Route("/TestReport")]
        public string TestPrint(string type)
        {

            using Report report = new Report();
            report.Load("3.frx");

            using FileStream fs = new FileStream("1.png", FileMode.Open, FileAccess.Read);
            byte[] buffur = new byte[fs.Length];
            fs.Read(buffur, 0, (int)fs.Length);
            fs.Close();

            using ImageExport image = new ImageExport();
            image.ImageFormat = ImageExportFormat.Jpeg;
            image.Resolution = 300;

            var data = new List<object>() { new { Image = buffur } };
            report.RegisterData(data, "Test");
            report.Prepare();
            using MemoryStream reportImageStream = new MemoryStream();
            report.Export(image, reportImageStream);

            return Convert.ToBase64String(reportImageStream.ToArray());
        }

My Code

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:22 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ElBedeawicommented, Nov 19, 2021

@Ramoshuai I tried the solution and it works fine the container memory went down to ~200MB

This is my current Dockerfile, may be it can be better but this is what worked with me.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
RUN apt-get update && apt-get install -y --allow-unauthenticated libc6-dev libgdiplus libx11-dev
RUN apt-get install -y libgif-dev autoconf libtool automake build-essential gettext libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev libpango1.0-dev git
WORKDIR /var/customLib
RUN git clone https://github.com/mono/libgdiplus.git
WORKDIR /var/customLib/libgdiplus
RUN ./autogen.sh --with-pango --prefix=/usr
RUN make
RUN make install
WORKDIR /app
EXPOSE 80
1reaction
ElBedeawicommented, Jul 5, 2022

Hi, we are experienceing the same behaviour with version 2022.2.12. This only happends in linux env, not in windows.

Can anyone confirm if @ElBedeawi solution works? Is it a problem with libgdiplus?

Regards

I haven’t tried the latest version yet, but for the version I’m using “2021.4.13” it was the issue and building it using that dockerfile worked fine for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Memory not freed after calling free() - malloc
Yes, I mean ps. After freeing the memory taken by the list, the OS still is out of memory. When more memory is...
Read more >
Using Memory Leak Checking
Memory leaks can be avoided by following a good programming practice of always freeing memory when it is no longer needed and paying...
Read more >
what happens when you don't free memory after using ...
If free() is not used in a program the memory allocated using malloc() will be de-allocated after completion of the execution of the...
Read more >
What happens if you don't free memory? : r/C_Programming
If a file or function is reused in another program, which has different memory requirements or runs on a different platform, not freeing...
Read more >
CWE-590: Free of Memory not on the Heap
The product calls free() on a pointer to memory that was not allocated using associated heap allocation functions such as malloc(), calloc(), or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found