X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fsettings.c;fp=src%2Fdata%2Fsettings.c;h=5f769a5222083cb21a4a9e5731d23740e2680145;hb=6d8462bae6c13a723c63da24ed7db2549efd4cc1;hp=3248324ea3a42640d95acf697a2813d21df123f6;hpb=f12fd1512c78016efefe5bfde70a188e625a44c4;p=pspp-builds.git diff --git a/src/data/settings.c b/src/data/settings.c index 3248324e..5f769a52 100644 --- a/src/data/settings.c +++ b/src/data/settings.c @@ -425,6 +425,16 @@ get_workspace (void) return workspace; } +/* Approximate maximum number of cases to allocate in-core, given + that each case contains VALUE_CNT values. */ +size_t +get_workspace_cases (size_t value_cnt) +{ + size_t case_size = sizeof (union value) * value_cnt + 4 * sizeof (void *); + size_t case_cnt = MAX (get_workspace () / case_size, 4); + return case_cnt; +} + /* Set approximate maximum amount of memory to use for cases, in bytes. */