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.

Reading a file many times using "using(var ~)" causes a memory leak.

See original GitHub issue

Read and complete the full issue template

Do you want to request a feature or report a bug?

  • Bug
  • Feature

If you are logging a possible bug or feature request, please test with the latest development build first.

Version of ClosedXML

e.g. 0.94.2

What is the current behavior?

Opening a file many times causes a memory leak and an exception occurs. Exception “OutOfMemoryException.” occurs.

What is the expected behavior or new feature?

Complete this.

Did this work in previous versions of our tool? Which versions?

Not checked.

Reproducibility

This is an important section. Read it carefully. Failure to do so will cause a ‘RTFM’ comment.

Without a code sample, it is unlikely that your issue will get attention. Don’t be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be minimal complete and verifiable. Sample spreadsheets should be attached whenever applicable. Remove sensitive information.

Code to reproduce problem:

public void Main()
{
    // test.xlsx is in styled cells and 20,000 Records.
    // Filesize in about 30MBytes.
    using (var workbook = new XLWorkbook("test.xlsx"))
    {
        // not process
    }

    using (var workbook = new XLWorkbook("test.xlsx"))
    {
        // not process
    }

    using (var workbook = new XLWorkbook("test.xlsx"))
    {
        // not process
    }
    // Repeat this
}
  • I attached a sample spreadsheet. (You can drag files on to this issue)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Pankratycommented, Aug 22, 2019
0reactions
ShinoharaTacommented, Aug 23, 2019

Looks good. Right now, I checked result OK. Thank you for your support. I am grateful to you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

8 Ways You can Cause Memory Leaks in .NET
Memory leaks are sneakily bad creatures. It's easy to ignore them for a very long time, while they slowly destroy the application. With...
Read more >
memory leak while adding elements from text file to ...
The variable array in your code lead to memory leak because it create a new reference to output every loop, and it was...
Read more >
4 Types of Memory Leaks in JavaScript and How to Get Rid ...
One common cause for increased memory consumption in connection with globals are caches). Caches store data that is repeatedly used.
Read more >
How to escape from memory leaks in JavaScript
Memory leaks are often caused due to flaws in your logic. ... As a solution, try to nullify these variables after use, or...
Read more >
Can continually assigning a variable in a shell script cause ...
So my question is: Could I be causing a memory leak by continually writing to this variable? Do I need to kill it...
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