I want to erase the memory register that stores the variables that are created while running python code (in QGIS). I tried using qgs.exitQgis() based on pyqgis manual. But I get an error saying NameError: name 'Qgs' is not defined.

Edit: Realized that qgs.exitQgis() is not usable for my purpose since my aim is not to have a stand alone pycode that uses QGIS library, moreover I noticed that running the command qgs = QgsApplication([], False), in order to define the variable qgs is making my QGIS2.14 interface unresponsive!

Apparently, I need to have some QGIS independent way to clear memory register.

  • 2
    It is a Python problem, see Python: Memory Management – gene Oct 1 '16 at 15:22
  • Did you define qgs correctly such as the way in the manual? – Joseph Oct 4 '16 at 9:51
  • @Joseph , u sound to be right.. Let me check once.. – Sai Krishna Oct 5 '16 at 9:47
  • @ Joseph , I realize that the method suggested in the manual is for Python stand alone. But my purpose is not that. Moreover, I noticed that using the command , 'qgs = QgsApplication([], False)' , inorder to define 'qgis' is paralyzing my script and leaving my QGIS interface unresponsive! – Sai Krishna Oct 5 '16 at 10:19
  • 1
    As @gene mentioned, this sounds more like a python problem which is probably better asked in StackOverflow. Saying that, there are a few questions which pick up on this such as: Clear variable in python; and How can I explicitly free memory in Python?. One of the suggested answers (which is what I do) is to create a function to set the various variables to None. – Joseph Oct 5 '16 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.