malloclab patched finally

This commit is contained in:
2025-06-04 17:06:19 +08:00
parent 628a771975
commit 23d48ee092
12 changed files with 18575 additions and 6 deletions

BIN
malloclab/malloc Executable file

Binary file not shown.

22
malloclab/trace_perfect.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# 检查 traces 目录下所有 trace 文件是否能得到100分
TRACE_DIR="traces"
PERFECT_LIST="PERFECT_TRACES.txt"
# 清空 PERFECT_LIST.txt
> "$PERFECT_LIST"
# 遍历所有 .rep 文件
for trace in "$TRACE_DIR"/*.rep; do
echo "Testing $trace..."
# 运行 malloc 并捕获输出
output=$(./malloc -f "$trace" 2>&1)
# 检查输出中是否包含 "Performance index = 100"
if echo "$output" | grep -q "100/100" ; then
echo "Perfect score found for $(basename "$trace")"
echo "$(basename "$trace")" >> "$PERFECT_LIST"
fi
done
echo "Updated $PERFECT_LIST with traces that achieved perfect scores."

View File

@ -0,0 +1,8 @@
amptjp-bal.rep
amptjp.rep
cccp-bal.rep
cccp.rep
cp-decl-bal.rep
cp-decl.rep
expr-bal.rep
expr.rep

View File

@ -0,0 +1,4 @@
seglist.rep
short1.rep
random2.rep
xterm.rep

View File

@ -0,0 +1,56 @@
amptjp-bal.rep
amptjp.rep
bash.rep
binary2-bal.rep
binary2.rep
binary-bal.rep
binary.rep
boat.rep
cccp-bal.rep
cccp.rep
chrome.rep
coalesce-big.rep
coalescing-bal.rep
coalescing.rep
cp-decl-bal.rep
cp-decl.rep
exhaust.rep
expr-bal.rep
expr.rep
firefox-reddit2.rep
firefox-reddit.rep
firefox.rep
freeciv.rep
fs.rep
hostname.rep
login.rep
ls.1.rep
ls.rep
malloc-free.rep
malloc.rep
merry-go-round.rep
mutt.rep
needle.rep
perl.1.rep
perl.2.rep
perl.3.rep
perl.rep
pulseaudio.rep
random2-bal.rep
random2.rep
random-bal.rep
random.rep
realloc2-bal.rep
realloc2.rep
realloc-bal.rep
realloc.rep
rm.1.rep
rm.rep
seglist.rep
short1-bal.rep
short1.rep
short2-bal.rep
short2.rep
stty.rep
tty.rep
xterm.rep

View File

@ -0,0 +1,8 @@
amptjp-bal.rep
amptjp.rep
cccp-bal.rep
cccp.rep
cp-decl-bal.rep
cp-decl.rep
expr-bal.rep
expr.rep

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,16 @@
1
0
6
12
1
a 0 2040
a 1 2040
f 1
a 1 4010
a 2 48
a 3 4072
f 3
a 4 4072
f 0
f 2
a 5 4072
f 0
f 1
f 2
f 3
f 4
f 5

View File

@ -0,0 +1,16 @@
1
6
12
1
a 0 2040
a 1 2040
f 1
a 2 48
a 3 4072
f 3
a 4 4072
f 0
f 2
a 5 4072
f 4
f 5

17
malloclab/traces/trace_check.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# 检查 traces 目录下所有 trace 文件是否可以运行
TRACE_DIR="traces"
TRACE_LIST="TRACE_LIST.txt"
# 清空 TRACE_LIST.txt
> "$TRACE_LIST"
# 遍历所有 .rep 文件
for trace in "$TRACE_DIR"/*.rep; do
echo "Testing $trace..."
if ./malloc -f "$trace" > /dev/null 2>&1; then
echo "$(basename "$trace")" >> "$TRACE_LIST"
fi
done
echo "Updated $TRACE_LIST with runnable traces."

View File

@ -0,0 +1,22 @@
#!/bin/bash
# 检查 traces 目录下所有 trace 文件是否能得到100分
TRACE_DIR="traces"
PERFECT_LIST="PERFECT_TRACES.txt"
# 清空 PERFECT_LIST.txt
> "$PERFECT_LIST"
# 遍历所有 .rep 文件
for trace in "$TRACE_DIR"/*.rep; do
echo "Testing $trace..."
# 运行 malloc 并捕获输出
output=$(./malloc -f "$trace" 2>&1)
# 检查输出中是否包含 "Performance index = 100"
if echo "$output" | grep -q "100/100" ; then
echo "Perfect score found for $(basename "$trace")"
echo "$(basename "$trace")" >> "$PERFECT_LIST"
fi
done
echo "Updated $PERFECT_LIST with traces that achieved perfect scores."

11917
malloclab/traces/xterm.rep.bak Normal file

File diff suppressed because it is too large Load Diff