Font Size: a A A

A Study Of Memory Management Of Python’s Virtual Machine

Posted on:2015-12-20Degree:MasterType:Thesis
Country:ChinaCandidate:J ZhouFull Text:PDF
GTID:2308330482978945Subject:Computer software and theory
Abstract/Summary:PDF Full Text Request
Dynamic programming language’s simplicity and learnability has largely reduced software development cycle, and is very popular among software developers. It has a widely usage in fields such as machine learning, scientific computing, Web development etc. Python is one of the most popular dynamic language. This thesis focuses on the optimization of memory resource management. Due to Python’s development philosophy, which is everything is object, Python’s development efficiency is very high, but its runtime efficiency may cause some headache. Based on this philosophy, Python’s VM divides all the objects into two different sorts:container objects and non-container objects. Both of the two objects are managed by memory pool.As we all know, modern operating systems all provide library functions which is malloc to help programmers get memory from operating system. As malloc is a generic memory management schema, it has many limitations. During the running of Python VM, lots of objects will be generated, so different operating systems’ different malloc implementations may not satisfy Python VM’s requirement. Based on malloc, the Python virtual machine adopts the memory pooling technique and automatic memory management technique to manage the memory. The major contributions of this thesis are as follows:depicting Python VM’s memory management in detail including container objects and non-container objects, Python VM’s three level memory pool technique, garbage collecting mechanic based on reference count, cyclic garbage collecting module. According to its defects we promoted an improved schema, and thus improved Python VM’s memory management efficiency, In order to validate our methods, first, we did our experiment of the non-container objects on an open source benchmark named Unladen-Swallow and found that this method highly improved Python’s Web application efficiency. In order to improve Python VM’s garbage collection efficiency we did an empirical study on Python VM’s cyclic garbage collection. We selected six typical open source projects and obtained its runtime information. The experiment data showed that cyclic garbage didn’t come up often. We know that traditional TD algorithm needs to scan the candidate roots three times, but the light weight cyclic collection algorithm only does this for one time. The shortage of light weight cyclic collection algorithm is that it lacks of completeness. We promoted an algorithm based on TD algorithm and light weight cyclic collection algorithm, the experiment result shows that our algorithm works well with Python VM.
Keywords/Search Tags:Python, virtual machine, memory management, greedy strategy, empirical study, garbage collection, optimization
PDF Full Text Request
Related items