Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Torch7 - not enough memory: you tried to allocate 0GB. Buy new RAM

Tags:

torch

lua

I tried to load a large audio dataset and implement audio.spectrogram.

I got this error:

$ Torch: not enough memory: you tried to allocate 0GB. Buy new RAM! at /home/XXXX/torch/pkg/torch/lib/TH/THGeneral.c:222
stack traceback:
[C]: at 0xb732c560
[C]: in function '__add'
/home/XXXX/torch/install/share/lua/5.1/audio/init.lua:107: in function 'spectrogram'
large.lua:24: in main chunk
[C]: in function 'dofile'
[string "_RESULT={dofile "large.lua"}"]:1: in main chunk
[C]: in function 'xpcall'
/home/XXXX/torch/install/share/lua/5.1/trepl/init.lua:650: in function 'repl'
...XX/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
[C]: at 0x0804d6d0

Does torch7 have the memory limit ?

like image 320
yutseho Avatar asked Jan 13 '16 07:01

yutseho


1 Answers

No, Torch does not have a memory limit but it requires that certain conditions are met when allocating memory.

If you take a look at THGeneral.c (where the error comes from), you'll see that this error is raised when the allocation using THAllocInternal has failed. From your output I guess you are on a Unix system and I also guess that you are trying to allocate a lot of memory (but less than 1GB). In the case where you want to align more than 5120 bytes, THAllocInternal will call posix_memalign for 64 byte aligned memory otherwise it will call standard malloc. That is to say that the error you see comes from either of those functions which are provided by your operating system. You will have to check there. You could also try to recompile Torch with the flag DISABLE_POSIX_MEMALIGN to rule that out.

like image 164
Henri Menke Avatar answered Sep 19 '22 16:09

Henri Menke