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 (or circular reference) when slicing Column

See original GitHub issue

After slicing a Column and discarding the reference to the original Column, the memory of the Column cannot be released. It seems that the original column is still referenced somewhere invisible.

Here’s the code to reproduce the issue. When using top to see memory usage, one finds that it climbs up quickly (and eventually runs out of memory) even though it shouldn’t.

# WARNING: following code results in excessive memory usage

import gc
import numpy as np
from astropy.table import Column

col = Column(data=np.random.rand(10000000), name='random')
for _ in range(1000):
    col = col[col > 0.5]
    gc.collect()

Below are the versions that I used, installed with conda, and are running on a 64-bit linux machine:

astropy 3.0.4
numpy   1.15.1
python  3.6.6

This issue might be related to #6276 (but the fix is in 3.0.4) and/or #6346, but I am not entirely sure.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mhvkcommented, Sep 19, 2018
1reaction
mhvkcommented, Sep 19, 2018

Thanks for reporting! I tried to reproduce and think this may be a numpy problem: I could not reproduce your problem with astropy 3.0.4, numpy 1.14.5 (Debian testing), or with current astropy but still numpy 1.14.5, but I do reproduce it when I use numpy current master, independent of astropy version; given your result, I suspect it started in numpy 1.15.

With a quick test, I found this is a problem for even the simplest possible ndarray subclass, so this is an upstream bug: See https://github.com/numpy/numpy/issues/11983

Read more comments on GitHub >

github_iconTop Results From Across the Web

Memory leaks due to circular referencing in PHP - Educative.io
Circular referencing is when different objects circularly refer to one another, ... Memory leak by circular dependency can also be resolved by explicitly ......
Read more >
Remove or allow a circular reference - Microsoft Support
The formula =D1+D2+D3 breaks because it lives in cell D3, and it's trying to calculate itself. To fix the problem, you can move...
Read more >
perlref - man pages section 1: User Commands - Oracle Help Center
This can lead to memory leaks. Because objects in Perl are implemented as references, it's possible to have circular references with objects as...
Read more >
Resin: A Holistic Service for Dealing with Memory Leaks in ...
Abstract. Memory leak is a notorious issue. Despite the extensive ef- forts, addressing memory leaks in large production cloud.
Read more >
Vertical slicing Getting the reusable and flexible design the first time ...
Memory issues: Is there any potential memory leak problems? ... collector is smart enough to deal with the circular references(ReferQ33in Java section).
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