mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-30 21:12:55 +08:00
085f35da73
Added `node.egc.meminfo()` to expose LVM usage (to make the regular `node.egc.ON_MEM_LIMIT` option usable). Extended the `node.egc.ON_MEM_LIMIT` option to also take negative limits, in which case that's taken as a request to keep a certain amount of heap available for non-Lua use.
18 lines
469 B
C
18 lines
469 B
C
// Lua EGC (Emergeny Garbage Collector) interface
|
|
|
|
#ifndef __LEGC_H__
|
|
#define __LEGC_H__
|
|
|
|
#include "lstate.h"
|
|
|
|
// EGC operations modes
|
|
#define EGC_NOT_ACTIVE 0 // EGC disabled
|
|
#define EGC_ON_ALLOC_FAILURE 1 // run EGC on allocation failure
|
|
#define EGC_ON_MEM_LIMIT 2 // run EGC when an upper memory limit is hit
|
|
#define EGC_ALWAYS 4 // always run EGC before an allocation
|
|
|
|
void legc_set_mode(lua_State *L, int mode, int limit);
|
|
|
|
#endif
|
|
|