Browse Source

[fix] collect garbage after searches to reduce memory footprint

Adam Tauber 8 years ago
parent
commit
ffbee4bb82
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      searx/search.py

+ 4
- 3
searx/search.py View File

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
18
 import threading
19
 import threading
19
-import searx.poolrequests as requests_lib
20
+from thread import start_new_thread
20
 from time import time
21
 from time import time
21
-from searx import settings
22
+import searx.poolrequests as requests_lib
22
 from searx.engines import (
23
 from searx.engines import (
23
     categories, engines
24
     categories, engines
24
 )
25
 )
25
-from searx.languages import language_codes
26
 from searx.utils import gen_useragent
26
 from searx.utils import gen_useragent
27
 from searx.query import Query
27
 from searx.query import Query
28
 from searx.results import ResultContainer
28
 from searx.results import ResultContainer
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