Yeah, chasing memory issues can be tricky. You can take a look at a similar thread: Filebeat high memory usage v6.4.2
In general we don't support filebeat 6.x, so please keep in mind that any optimizations or fixes would rather be available in newer releases.