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