python - How to limit memory usage ofPython _ pandas -
currently using panda operation merge 2 csv file take around 4.6 gb ram want limit ram usage 2 gb java -xmax , -xmin
is way so
thanks in advance
use setrlimit
:
import resource rsrc = resource.rlimit_data soft, hard = resource.getrlimit(rsrc) print 'soft limit starts :', soft resource.setrlimit(rsrc, (1024, hard)) #limit 1 kilobyte soft, hard = resource.getrlimit(rsrc) print 'soft limit changed :', soft
edit: actually, i'm not sure if setrlimit
controls cpu or ram usage. shell, make use of ulimit
:
ulimit -v 128k python script.py ulimit -v unlimited
edit: please note linux systems, , i'm not sure how this, or if it's possible on windows.
Comments
Post a Comment