apps/fil3s: Limit filesize to 10KiB
As discovered by @moon2, trying to open large text files (like tiny_sampler/__init__.py
) crashes the system (10600b works, 11200b doesn't). Print debugging reveals this happens when we pass the entire thing to ctx.text()
(cc @pippin).
We should eventually improve the whole thing (#170), but in the meanwhile this is a workaround to prevent shipping smth broken on v1.3.0 by introducing a filesize limit of 10240b (10KiB).
(I've also added some gc.collect()
s in there just for good measure, they're not strictly needed but they don't hurt either.)