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.

Memory leak when saving pyramid files

See original GitHub issue

When I open a TIFF image using access='sequential' and then save it using compression='jpeg' memory is not released.

Minimal example to reproduce the issue (run passing a large image file path as first parameter:


#!/usr/bin/env python3

import sys

import pyvips

fpath = sys.argv[1]

i = 1
while True:
    print('Iteration {}'.format(i))
    with open(fpath, 'rb') as fh:
        img = pyvips.Image.new_from_buffer(fh.read(), '', access='sequential')
        img.tiffsave('/tmp/flush.tif', compression='jpeg', Q=90)
    i += 1

You can observe memory constantly increasing until eventually the program crashes.

Note that if I don’t use sequential access, or JPEG compression, the memory is flushed as normal.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:52 (25 by maintainers)

github_iconTop GitHub Comments

2reactions
scossucommented, Mar 20, 2019

@workergnome track this

0reactions
sixtyfivecommented, Apr 29, 2021

For anyone googling for how to deal with extracting the pages from large PDF files as images, this Issue got me on the right path. The cache doesn’t have to be disabled completely, just limited. Example script here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python-pyramid app memory is not releasing at all
How to solve this memory leak? What measures should I take to cleanup old session objects? Isn't session.close() is sufficient? or. Is it ......
Read more >
Memory leak occurs when you transfer a file that is larger than ...
Memory leak occurs when you transfer a file that is larger than 5 megabytes (MB) in a conversation in Skype for Business. This...
Read more >
Google Code Archive - Google Code
646, WontFix, memory leak in 1183 Type-Defect Priority-Low. 645, Duplicate, 1177 Float - Crash on save. Windows 7 64bit 4GB RAM Type-Defect Priority-Low....
Read more >
Memory leak - Wikipedia
In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in...
Read more >
web.mit.edu/GRAPHICS/OldFiles/src/xv/CHANGELOG
(Alan Blanchard (alan@abraxas.mbt.washington.edu)) Bug Fix: Memory leak if '-ncols 0' on a > 1-bit display Change: In the Save window, moved 'File list' ......
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