Skip to content

Heap size does not change after function call. #568

Closed Answered by godlygeek
paniabhisek asked this question in Q&A
Discussion options

You must be logged in to vote

This is happening because CPython doesn't release that memory at teardown because it's still on the freelists of the interpreter

No, it's nothing so complicated as that...

I do not see any deallocation of heap size.

When I perform the steps you've given, I do see the heap size drop:

That circle shows the spot where fib1() has returned (and its temporary list has been freed) but fib2() has not yet built up a large cache. As the program continues running, the cache owned by fib2() gets larger and larger, until eventually it's even larger than the temporary list that was created while fib1() ran. That point marks the program's heap high water mark. 2 seconds later the main script finish…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@pablogsal
Comment options

Comment options

You must be logged in to vote
1 reply
@paniabhisek
Comment options

Answer selected by godlygeek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #567 on March 13, 2024 13:50.