45bd14b392
Derivative of work by RobertGabrielJakabosky http://lua-users.org/wiki/EmergencyGarbageCollector I've only implemented the not enough memory part and expanded this idea to adding a mechanism to signal the OOM condition of the plugin buffer which allows us to only grab the playback buffer after garbage collection fails (SO THE MUSIC KEEPS PLAYING AS LONG AS POSSIBLE) Change-Id: I684fb98b540ffc01f7ba324ab5b761ceb59b9f9b
18 lines
270 B
C
18 lines
270 B
C
#include "plugin.h"
|
|
#include "lstate.h"
|
|
#include LUA_USER_H
|
|
|
|
/* lua Out Of Memory */
|
|
static struct lua_OOM l_oom = {NULL, 0};
|
|
|
|
int set_lua_OOM(lua_State * L)
|
|
{
|
|
l_oom.L = L;
|
|
l_oom.count++;
|
|
return 0;
|
|
}
|
|
|
|
struct lua_OOM *get_lua_OOM(void)
|
|
{
|
|
return &l_oom;
|
|
}
|