mailing list of musl libc
 help / color / mirror / code / Atom feed
* LUA + musl, garbage collection issue?
@ 2014-09-21  2:41 Scott Valentine
  2014-09-21  4:38 ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Scott Valentine @ 2014-09-21  2:41 UTC (permalink / raw)
  To: lua-l, musl

I have been testing OpenWRT builds using musl as the libc on arm and mips targets, and I have run into an issue which appears to be related to lua.
Essentially, when using the luci web interface to upload a file to the device, I am running into a memory exhaustion problem. A 6 MB upload results in nearly 70MB of memory allocation.
On smaller targets (i.e. 64MB RAM), it pretty much just locks up the system until the watchdog timer expires and reboots.
On bigger targets with enough RAM, the process completes and the memory is freed, but I think this is because the lua process exits.

On eglibc and uclibc builds I only see marginal memory increases during the upload, mostly do to the file getting written to tmpfs.

I'm having trouble tracking down where the issue is, but it looks like lua exclusively uses realloc for managing memory. Is this correct?

I noticed that in order to free memory, it basically calls realloc with 0 as the new size. Is this something musl doesn't handle well?

I'm trying a rebuild with a check for n == 0 in musl's realloc function to just free the pointer, and I'll report back.

What is "the right thing to do" to fix this? Should lua not be using realloc to free memory, or should musl handle the case better, if, in fact this is the problem?

Regards,
-Scott V.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-24  6:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-21  2:41 LUA + musl, garbage collection issue? Scott Valentine
2014-09-21  4:38 ` Rich Felker
2014-09-21  9:58   ` Scott Valentine
2014-09-21 10:16   ` Justin Cormack
2014-09-24  5:25     ` Scott Valentine
2014-09-24  5:50       ` Szabolcs Nagy
2014-09-24  6:14         ` Scott Valentine

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).