I was trying to read a big file and write its contents to another file. There was a strange spike in memory usage and when I isolated the piece of code just for reading and writing, strange negative values are shown in Increment column. Since python does not read whole of the file in memory what should be the reason for memory spike. I am using python 3.6.
Line 8 and line 9 shows a strange spike in memory. I came across a related question Strange increment value reported during IPython memory profiling, but here a list is being created which might attribute for space consumption. What might be the case for file reading and writing.