浏览代码

[fix] collect garbage after searches to reduce memory footprint

Adam Tauber 8 年前
父节点
当前提交
ffbee4bb82
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4
    3
      searx/search.py

+ 4
- 3
searx/search.py 查看文件

@@ -15,14 +15,14 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
15 15
 (C) 2013- by Adam Tauber, <asciimoo@gmail.com>
16 16
 '''
17 17
 
18
+import gc
18 19
 import threading
19
-import searx.poolrequests as requests_lib
20
+from thread import start_new_thread
20 21
 from time import time
21
-from searx import settings
22
+import searx.poolrequests as requests_lib
22 23
 from searx.engines import (
23 24
     categories, engines
24 25
 )
25
-from searx.languages import language_codes
26 26
 from searx.utils import gen_useragent
27 27
 from searx.query import Query
28 28
 from searx.results import ResultContainer
@@ -347,6 +347,7 @@ class Search(object):
347 347
             return self
348 348
         # send all search-request
349 349
         threaded_requests(requests)
350
+        start_new_thread(gc.collect, tuple())
350 351
 
351 352
         # return results, suggestions, answers and infoboxes
352 353
         return self