New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LZ4F_compressFrame() seems to use an abnormally large amount of call stack on Arm Compiler 6.15 (armclang) #1145
Comments
Hi @borbmizzet, thanks for the report. I've tried the following Cortex-A8 emulation, and it works fine on my environment.
Could you try to build genuine lz4cli and test it? |
Could you define "abnormally large" ? |
It would be interesting to know what is considered "large" for this setup.
If that amount is considered too much, even that can be exported onto the heap, |
I don't have any specifics on the stack usage without lz4, but our stack size for the thread in question was capped at 10KB on a 32-bit build, but even with lz4 with pretty much identical call stack up to that point, none of our other 32 or 64 bit builds even come close to hitting that cap. It seems like it would be some sort of recursive call in lz4 based on some compiler-specific code or something, because doubling the stack size for that thread on that build fixed the stack overflow, though it still topped off at 18KB stack usage. |
It looks like the 16KB hash table is a candidate member of this stack budget. But it shouldn't be: in "recent" versions, this budget has been moved to heap. Which begs the question : which version are you using in your tests ? |
1.9.3 |
Indeed, that's where the stack memory budget is. The solution is to compile the library with If you can't recompile, the alternative is to not use |
I'll give that a shot, thanks! |
Updating to 1.9.4 fixed the issue. However, I've looked through the commit log between 1.9.3 and 1.9.4, and have been unable to pinpoint the exact commit(s) that makes this change. Could someone point it out for me? Also, the reason our other builds didn't stack overflow was because the stack size for all threads on our other builds was, unbeknownst to me, overridden to 1MB on a lower layer. |
LZ4F_compressFrame() seems to use an abnormally large amount of call stack on Arm Compiler 6.15 (armclang).
Compiler flags:
-D_NO_UNALIGNED_ACCESS = True
-D_ARM_TARGET_CPU = 'Cortex-A8'
-D_ARM_TARGET_CPU_REV = 'r3p2'
-D_ARM_TARGET_FPU = 'softvfp+vfpv3'
-D_ARMCLANG_TARGET_CPU = 'cortex-a8'
-D_ARMCLANG_TARGET_FPU = 'neon'
-D_ARMCLANG_MFLOAT_ABI = 'softfp'
-gdwarf-3
-fno-strict-aliasing
-fwrapv
-fshort-enums
-fhonor-nans
-fhonor-infinities
-O1
-std=gnu99
-g
Attempted to compress the attached binary data (the contents of the data.bin file inside the attached data.zip file) using the following code:
The text was updated successfully, but these errors were encountered: