본문 바로가기

개발

Lua 의 PANIC: unprotected error in call to Lua API (not enough memory) 에러

728x90

 

Lua 로 개발된 deep learning 프레임워크를 사용하다 보면 아래와 같은 not enout memory 에러가 발생하는 경우가 있다.

PANIC: unprotected error in call to Lua API (not enough memory)

 

이런 에러가 발생하는 경우 제일 먼저 현재 설치된 Lua 버전이 LuaJIT 인지 확인해본다. LuaJIT 이라면, 코드상의 문제라기 보단 LuaJIT 의 memory issue 일 가능성이 높다.

his is a LuaJIT memory issue. The total memory of Lua objects (tables, strings) is limited to about 2GB.

 

이를 해결하기 위해서는 Lua52 로 설치하면 해결 된다. 아래의 명령어는 torch 에서 Lua52 를 설치하는 명령어이다.

cd ~/torch
cd ~/torch; bash install-deps;
./clean.sh
TORCH_LUA_VERSION=LUA52 ./install.sh

이렇게 Lua52 로 설치를하면 LuaJIT 의 2GB 메모리 제한이 풀린다. :)