Skip to content

increment and mem usage are not consistent #253

Open

Description

@anyuzx

Hi, I would appreciate it if someone can help me understand the results here. Please see this screenshot, mem usage increases from line 5 to line 6 but the increment is zero. This is from using %mprun -T in Jupyter notebook.

Screenshot 2019-10-07 10 01 54

My understanding is that the "increment" report the memory increase after the execution of a line and "mem usage" is the memory usage at the current line. But this seems doesn't explain the results shown here.

Activity

  1. fabianp commented on Oct 7, 2019

    @fabianp
    Collaborator

    it should, but it currently does strange things in the presence of loops. pull requests welcomed

  2. halfdan commented on Feb 13, 2020

    @halfdan

    I'm seeing something very similar with a test script:

    Filename: example.py
    
    Line #    Mem usage    Increment   Line Contents
    ================================================
        14   11.797 MiB   11.797 MiB   @profile
        15                             def allocate():
        16   11.805 MiB    0.008 MiB   	print("Allocating foos")
        17   36.121 MiB    0.660 MiB   	foos = [Foo() for _ in range(100000)]
        18   36.121 MiB    0.000 MiB   	print("Allocating bars")
        19   43.113 MiB    0.660 MiB   	bars = [Bar() for _ in range(100000)]
    

    Note how the increases from line 16 to 17 by ~25MiB but the increment is shown as 0.66 MiB

  3. ianozsvald commented on Apr 8, 2020

    @ianozsvald
    Contributor

    @anyuzx @halfdan I think this is related to my bug in #236 , there's no fix as yet.

  4. brianzhang01 commented on Sep 8, 2020

    @brianzhang01

    You may want to rebuild and try again now that #280 is in to see if that solves your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions