Spacy Memory Profiling gives some weird behavior! #12206
Answered
by
polm
Salekeen
asked this question in
Help: Coding & Implementations
-
Can someone explain to me why line 15 increases memory? |
Beta Was this translation helpful? Give feedback.
Answered by
polm
Jan 31, 2023
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Salekeen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import
is specially implemented in Python to not do anything if it's called a second time. In contrast,spacy.load
doesn't know if it's been called before, so it loads things from disk and creates new structures in memory. Since you are shadowing the old variable, after garbage collection is run the extra memory from the second call should go away, but there's no guarantee it happens immediately.