Professional Documents
Culture Documents
Labep 2
Labep 2
do_append appends size elements to an array, while do_allocate initializes the vector to size
and then sets the elements.
We can see how the memory usage slowly increases (the free column goes down
gradually).
The same happens for do_allocate because of on-demand paging (i.e. our result
array is “allocated” but it appears in memory only when it’s set). Arrays in python are arrays
of references, anyway, so it’s not like the array itself uses up a lot of space: rather, the
messages themselves start taking up more and more space as they are created.
For experiment 3, memory gets used, then freed, then used again:
Teaca Maria 343C3
For experiment 4, because references to the arrays are kept, more and more memory gets
used (stopped it early so it doesn’t eat away at my computer)
For changing the code so both experiments 3 and 4 use the same amount of memory, I think
we’d have to convince python that the two messages created in the two functions are the
same and so the reference may be reused, but I’m unsure how.
Sorry, but I really don’t want to risk messing up my machine. And I sadly don’t have enough
space for a VM so welp.
Teaca Maria 343C3
+ file + partition
Don’t take up more than they use, so better Reduced fragmentation as it is isolated from
space management main filesystem
0 before, quite a few after. Sadly it all happened so fast that the vmstat didn’t register a spike
in pages used :(
Teaca Maria 343C3
Nice!
No, it was the value read from memory by each of these instructions. Close enough!
Write instructions have entered the arena: the red output is probably the value written by the
instruction, while the yellow represents what was there beforehand.
There we go!