1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Enforce 2GB host memory per GPU limit

This commit is contained in:
Jens Steube 2018-02-12 15:29:08 +01:00
parent c9f3ef6dae
commit 31da893a40

View File

@ -5923,11 +5923,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
size_t size_tmps = 4;
size_t size_hooks = 4;
// instead of adding a thread limit we can also use a memory limit.
// instead of a thread limit we can also use a memory limit.
// this value should represent a reasonable amount of memory a host system has per GPU.
// note we're allocating 3 blocks of that size.
#define PWS_SPACE (64 * 1024 * 1024)
#define PWS_SPACE (512 * 1024 * 1024)
// sometimes device_global_mem and device_maxmem_alloc reported back from the opencl runtime are a bit inaccurate.
// let's add some extra space just to be sure.
@ -5965,10 +5965,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
int memory_limit_hit = 0;
if (user_options->workload_profile < 4)
{
if (size_pws > PWS_SPACE) memory_limit_hit = 1;
}
if (size_pws > PWS_SPACE) memory_limit_hit = 1;
if ((size_pws + EXTRA_SPACE) > device_param->device_maxmem_alloc) memory_limit_hit = 1;
if ((size_tmps + EXTRA_SPACE) > device_param->device_maxmem_alloc) memory_limit_hit = 1;