I am running tor 4.0.1-alpha inside a docker container with a memory limit (6GB). Tor runs out of memory and aborts or crashes periodically.

Usually I see an error message like this:
Could not mmap file "/var/lib/tor/data/diff-cache/1149": Out of memory
...(repeated some number of times)
followed by segfault

Sometimes I see a message:
Out of memory on malloc(). Dying
followed by abort.

Am I correct to assume the diff-cache is the issue here? Looking at the files it seems they are all pretty small (~500K). Is some badly behaved client requesting 12,000 of these diffs causing my relay to mmap them all at once? or is it just expensive to generate and generating 30-60 at once is enough to use all the memory?

Are there any config options to reject expensive queries or otherwise limit concurrency?

Thanks