Open Quuxplusone opened 2 years ago
Attached stack_dump_out_of_memory.zip
(4472 bytes, application/x-zip-compressed): stack dump
"out of memory" means that malloc failed. If you're using a 64-bit Linux clang binary, usually you'll trigger the OOM killer well before you actually hit a malloc failure, so you have some sort of unusual configuration. Maybe ulimit? In any case, you'll probably have to investigate yourself.
Note that files of that form use much more memory than you might expect at first glance because clang constructs multiple AST nodes for each byte. If you control the process generating these files, you might consider doing something else; for example, a string literal uses much less memory.
The ulimit look to be quite permissive, at least the important ones (if I am
not mistaking) are unlimited.
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 127341
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 127341
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
For the recommended "string literal" value, should having a string like static
char buff[NSIZE] = "\x7a\x6c\x69\x62\x20\x69..." be much less resource
intensive?
(In reply to Andrei Roventa from comment #2)
> For the recommended "string literal" value, should having a string like
> static char buff[NSIZE] = "\x7a\x6c\x69\x62\x20\x69..." be much less
> resource intensive?
Yes. I think last time someone looked, the memory usage for a string like that
ends up at roughly 3x the size of the array? Vs. your original testcase, where
it's on the order of 100x.
Oh, and before you go too deep, probably worth confirming you clang binary is actually 64-bit ("file clang" or something like that).
stack_dump_out_of_memory.zip
(4472 bytes, application/x-zip-compressed)