I deleted and installed a few packages but I think the old memory was not replaced. How can I delete them?
If you upgrade packages (which you shouldn't), they don't overwrite the same package coming with the image.
Deleting packages shipping with the image, won't free up any flash space.
If you want to get rid of them, create a new image, without them.
sysupgrade , auc , attendedsysupgrade, owut ....
Yes use Firmware Selector, Image Builder, or Upgrade Tool to build a new custom ROM with the packages you want.
So is there no code or anything to free up my memory?
overlay accumulates space for all changed files, like upgrade of existing luci library takes place in squashfs and additionally space in overlay for changed files. Solution is to re-compose squashfs with packages you have installed,
Actually I am new to openwrt, I don't quite understand what you mean, is there a guide on how to do it?
No learning option - install luci-app-attendedsysupgrade and do the upgrade via new luci menu.
Assuming you're running squashfs images, the squashed /rom partition is immutable by the running OpenWrt. Files deleted or replaced from there are marked as deleted in the overlay (and the new version of replaced files is stored in the overlay), but the flash space taken by the original file cannot be reclaimed. A different ROM has to be built off-line then installed in flash with a sysupgrade.
Also the squashfs process is more efficient compression than that used when storing files in overlay. So making a ROM with a package included takes less space than installing the same package later.
You can remove kernel modules not needed from loading which will save ram and also take a look at: https://openwrt.org/docs/guide-user/additional-software/saving_space
You can also consider Extroot https://openwrt.org/docs/guide-user/additional-software/extroot_configuration?s=extroot#extroot_configuration
assuming there's an USB port, yes ...
got to
http://192.168.1.1/cgi-bin/luci/admin/system/flash
Reset to defaults Perform a reset
Forget everything else for now.