I'm using zRAM-Disks too::
"mkzram" (without ".sh"):
#!/bin/bash
if [ $# == 0 ];then echo "mkzram [Size in G] [zstd] (otherwise lz4)";exit;fi
al=lz4
if [ $2 == "zstd" ] 2>/dev/null;then al=zstd;fi
if [ ! -e /dev/zram* ] 2>/dev/null
then sudo modprobe zram;id=0
else id=$(sudo cat /sys/class/zram-control/hot_add)
fi
echo $al|sudo tee /sys/block/zram$id/comp_algorithm >/dev/null
echo $1"G"|sudo tee /sys/block/zram$id/disksize >/dev/null
sudo mkfs.xfs -q /dev/zram$id && mkdir /tmp/zram$id
sudo mount -o discard /dev/zram$id /tmp/zram$id/ && sudo chmod 777 /tmp/zram$id/
zramctl -o name,algorithm,disksize,data,compr,mountpoint
"rmzram" (without ".sh"):
#!/bin/bash
if [ $# == 0 ];then echo "rmzram [ID]:";zramctl -o name,algorithm,disksize,data,compr,mountpoint;exit;fi
sudo umount -l /tmp/zram$1/ && rm -rf /tmp/zram$1
echo $1|sudo tee /sys/class/zram-control/hot_remove > /dev/null
if [ ! -e /dev/zram* ] 2>/dev/null;then sudo modprobe -r zram;fi
zramctl -o name,algorithm,disksize,data,compr,mountpoint
/tmp/ is in RAM, /tmph/ for huge Files (i. e. DVB-S Videocut):
memory /tmp tmpfs nosuid,size=90% 0 0
memory /tmph tmpfs huge=always,size=90% 0 0
(from my /etc/fstab)
As said: I tested a lot.