【发布时间】:2019-01-18 02:22:49
【问题描述】:
NodeMCU 信息
> Lua 5.1.4
> SDK 2.2.1
> Memory Usage :
> Total : 3260490 bytes
> Used : 9287 bytes
> Remain: 3251203 bytes
当我尝试发送带有大 json 字符串响应 (json_response) 的 HTTP 响应时出现错误
PANIC: unprotected error in call to Lua API (file.lua:5: out of memory)
代码:
-- a simple HTTP server
srv = net.createServer(net.TCP)
srv:listen(80, function(conn)
conn:on("receive", function(sck, payload)
sck:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"..json_response)
end)
conn:on("sent", function(sck) sck:close() end)
end)
【问题讨论】:
-
这里需要任何进一步的反馈吗?
-
@MarcelStör 我正在查看是否有办法调整内存以处理一次,但我想这还不可能。
标签: memory-management lua out-of-memory esp8266 nodemcu