ref: cf81dd19f0c898fa6036d1f88cbe822eb8a2b4bf
parent: 52a5be5adc041a5dc8daa1238a1f307c728e75c8
author: Ori Bernstein <[email protected]>
date: Mon Nov 30 21:25:04 EST 2015
Reduce mbld memory leakage.
--- a/lib/std/resolve+posixy.myr
+++ b/lib/std/resolve+posixy.myr
@@ -10,6 +10,7 @@
use "option.use"
use "result.use"
use "slcp.use"
+use "sldup.use"
use "sleq.use"
use "slpush.use"
use "slurp.use"
@@ -120,6 +121,7 @@
;;
;;
slfree(lines)
+ slfree(h)
}
const addhosts = {addr, as, str
@@ -143,7 +145,7 @@
.ttl = 0,
.addr = addr
]
- htput(hostmap, name, hinf)
+ htput(hostmap, sldup(name), hinf)
| `None:
->
;;
@@ -176,6 +178,7 @@
;;
;;
slfree(lines)
+ slfree(h)
}
const addns = {rest
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -237,6 +237,7 @@
cflags = std.slpush(cflags, std.sldup(fl))
;;
std.slfree(flags)
+ regex.matchfree(m)
;;
match regex.exec(clibpat, ln)
@@ -247,6 +248,7 @@
libs = std.slpush(libs, std.sldup(fl))
;;
std.slfree(flags)
+ regex.matchfree(m)
;;
-> (cflags, libs)
}
@@ -299,6 +301,7 @@
else
deps = std.slpush(deps, `Local (std.sldup(uses[3]), lnum))
;;
+ regex.matchfree(uses)
| `std.None:
/* nothing to do */
;;
@@ -381,7 +384,6 @@
if opt_debug
std.put("{} <= {}\n", dst, src)
;;
- std.assert(dst.len < 200, "BUG!")
sl = std.htgetv(dg.deps, dst, [][:])
sl = std.slpush(sl, src)
std.htput(dg.deps, dst, sl)
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -62,7 +62,6 @@
;;
type depgraph = struct
- roots : byte[:][:]
deps : std.htab(byte[:], byte[:][:])#
libs : std.htab(byte[:], byte[:][:])#
input : std.htab(byte[:], byte[:])#