1. Define a minimun of MEM to be used when the jobs don't use request_mem.
# Minimun Memory when job don't request any / Minimo de Memoria RAM cuando la tarea no solicita
JOB_DEFAULT_REQUESTMEMORY=256
MODIFY_REQUEST_EXPR_REQUESTMEMORY=quantize(RequestMemory, {256})
2. the Startd checks the memory used by the Jobs
# Check Memory used by the job / Verificar memoria usada por la tarea
MEMORY_EXCEEDED=((MemoryUsage*1.1 > Memory) =?= TRUE)
3. If the Jobs exceed the memory allowed, Hold it.
# If Memory Exceded, Evict job / Si se excede la memoria, cancelar la tarea
PREEMPT=($(PREEMPT)) || $(MEMORY_EXCEEDED)
WANT_SUSPEND=$(WANT_SUSPEND) && $(MEMORY_EXCEEDED)
WANT_HOLD=$(MEMORY_EXCEEDED)
4. Set a Hold Reason so the user knows why the Jobs is Holded.
# Message to Job's owner / Mensaje para el propietario del Job.
WANT_HOLD_REASON=ifThenElse( $(WANT_HOLD),"Job exceeded available memory. La tarea excedio la memoria disponible.",undefined )
I've been using this configuration and works fine in our pool.
I hope this helps you.