从资源限制的参数列表里按语言获取相关信息,并作为当前的资源限制参数。
(session *JudgeSession)
| 208 | |
| 209 | // 从资源限制的参数列表里按语言获取相关信息,并作为当前的资源限制参数。 |
| 210 | func updateLimitation(session *JudgeSession) { |
| 211 | langName := session.Compiler.GetName() |
| 212 | memoryLimitExtend := 0 |
| 213 | jitMem, ok := constants.MemorySizeForJIT[langName] |
| 214 | if ok { |
| 215 | memoryLimitExtend = jitMem |
| 216 | } |
| 217 | limitation, ok := session.JudgeConfig.Limitation[langName] |
| 218 | if ok { |
| 219 | session.JudgeConfig.TimeLimit = limitation.TimeLimit |
| 220 | session.JudgeConfig.MemoryLimit = limitation.MemoryLimit + memoryLimitExtend |
| 221 | session.JudgeConfig.RealTimeLimit = limitation.RealTimeLimit |
| 222 | session.JudgeConfig.FileSizeLimit = limitation.FileSizeLimit |
| 223 | return |
| 224 | } |
| 225 | session.JudgeConfig.MemoryLimit = session.JudgeConfig.MemoryLimit + memoryLimitExtend |
| 226 | } |