Bug#909122: diffoscope: MemoryError when comparing big ISO images

Daniel Shahaf danielsh at apache.org
Tue Sep 18 20:14:07 BST 2018


Marek Marczykowski-Górecki wrote on Tue, 18 Sep 2018 21:09 +0200:
> On Tue, Sep 18, 2018 at 09:00:11PM +0200, Marek Marczykowski-Górecki wrote:
> > On Tue, Sep 18, 2018 at 06:39:28PM +0000, Daniel Shahaf wrote:
> > > Slurping the file to a string object is an antipattern.  Instead of
> > > using f.read() to create a 4.5GB string, it would be better to use
> > > json.load(f) to read the file incrementally.  That should raise an
> > > exception rather quickly.
> > 
> > That may be even better! Expect MR in a moment. Should I include some
> > magic text in commit message to link it with this bug?
> 
> Nope, json.load:
> 
>     def load(fp, *, cls=None, object_hook=None, parse_float=None,
> ...
>         return loads(fp.read(),
> ...

I stand corrected...

... and surprised.

Cheers,

Daniel



More information about the Reproducible-builds mailing list