diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f877b13be..fb5b227540 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,10 +10,12 @@ All notable changes to this project will be documented in this file.
- [#1964] Freezing on releasing mouse while shape transforming (deadlock)
- [#1961] Characters can use characterId 0, PlaceObject can use depth 0
- [#1963] Reading CLIPEVENTFLAGS ClipActionEndFlag on SWF versions >= 6
+- [#1968], [#1971], [#1957] Cannot start FFDec due to large stack size on some configurations
### Changed
- [#1960] Quick search does not search in SWF name or folder names
- [#1961] SoundStreamHead on main timeline is exported/imported with identifier "-1"
+- [#1957] Larger stack size (when needed) must be configured manually in ffdec.bat or ffdec.sh
## [18.3.4] - 2023-01-30
### Added
@@ -2948,6 +2950,8 @@ All notable changes to this project will be documented in this file.
[#1964]: https://www.free-decompiler.com/flash/issues/1964
[#1961]: https://www.free-decompiler.com/flash/issues/1961
[#1963]: https://www.free-decompiler.com/flash/issues/1963
+[#1968]: https://www.free-decompiler.com/flash/issues/1968
+[#1971]: https://www.free-decompiler.com/flash/issues/1971
[#1029]: https://www.free-decompiler.com/flash/issues/1029
[#1948]: https://www.free-decompiler.com/flash/issues/1948
[#1941]: https://www.free-decompiler.com/flash/issues/1941
diff --git a/build.xml b/build.xml
index 1a47bb8653..16c766229a 100644
--- a/build.xml
+++ b/build.xml
@@ -420,7 +420,7 @@
preferJre
64/32
${max.heap.size.percent}
- -Xss${max.stack.size}m
+
-Djava.net.preferIPv4Stack=true
-Djna.nosys=true
@@ -696,7 +696,7 @@
-
+
diff --git a/resources/ffdec.bat b/resources/ffdec.bat
index 116bc37508..6f7312e729 100644
--- a/resources/ffdec.bat
+++ b/resources/ffdec.bat
@@ -1,12 +1,18 @@
@echo off
+rem This is a comment, it starts with "rem".
+
rem Set following to higher value if you want more memory:
rem You need 64 bit OS and 64 bit java to set it to higher values
set MEMORY=1024m
-rem Set following to higher value when you encounter StackOverFlowErrors
-set STACK_SIZE=32m
+rem Uncomment following when you encounter StackOverFlowErrors.
+rem If the app then terminates with OutOfMemory you can experiment with lower value.
+rem set STACK_SIZE=32m
rem Hide VLC error output
set VLC_VERBOSE=-1
-java -Xmx%MEMORY% -Xss%STACK_SIZE% -Djna.nosys=true -jar "%~dp0\ffdec.jar" %*
\ No newline at end of file
+if not "%STACK_SiZE%"=="" set STACK_SIZE_PARAM= -Xss%STACK_SiZE%
+if not "%MEMORY%"=="" set MEMORY_PARAM=-Xmx%MEMORY%
+
+java %MEMORY_PARAM%%STACK_SIZE_PARAM%-Djna.nosys=true -jar "%~dp0\ffdec.jar" %*
\ No newline at end of file
diff --git a/resources/ffdec.sh b/resources/ffdec.sh
index 165f39bd8c..d69560134d 100644
--- a/resources/ffdec.sh
+++ b/resources/ffdec.sh
@@ -1,11 +1,14 @@
#!/usr/bin/env bash
+# This is a comment, it starts with "#".
+
# Set following to higher value if you want more memory
# You need 64 bit OS and 64 bit java to set it to higher values
MEMORY=1024m
-# Set following to higher value when you encounter StackOverFlowErrors
-STACK_SIZE=32m
+# Uncomment following when you encounter StackOverFlowErrors.
+# If the app then terminates with OutOfMemory you can experiment with lower value.
+# STACK_SIZE=32m
# Hide VLC error output
export VLC_VERBOSE=-1
@@ -77,7 +80,14 @@ fi
popd > /dev/null
-args=(-Djava.net.preferIPv4Stack=true -Xmx$MEMORY -Xss$STACK_SIZE -jar $JAR_FILE "$@")
+if [ -n "$STACK_SIZE" ]; then
+ STACK_SIZE_PARAM=" -Xss$STACK_SIZE"
+fi
+if [ -n "$MEMORY" ]; then
+ MEMORY_PARAM=" -Xmx$MEMORY"
+fi
+
+args=(-Djava.net.preferIPv4Stack=true${MEMORY_PARAM}${STACK_SIZE_PARAM} -jar $JAR_FILE "$@")
if [ "`uname`" = "Darwin" ]; then
args=(-Xdock:name=FFDec -Xdock:icon=icon.png "${args[@]}")