Virtual memory exhausted: Cannot allocate memory

I get virtual memory exhausted: Cannot allocate memory error on DockerHub after 100 minutes of building an image. I am probably hitting a hard limit on memory or build time, but I am curious if there is any workaround for this issue or an upgrade option for these limits?