Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/memutil')
-rw-r--r--intern/memutil/MEM_CacheLimiter.h7
-rw-r--r--intern/memutil/MEM_CacheLimiterC-Api.h2
-rw-r--r--intern/memutil/intern/MEM_CacheLimiterC-Api.cpp12
3 files changed, 21 insertions, 0 deletions
diff --git a/intern/memutil/MEM_CacheLimiter.h b/intern/memutil/MEM_CacheLimiter.h
index 88e06833b4a..bbe6ace2456 100644
--- a/intern/memutil/MEM_CacheLimiter.h
+++ b/intern/memutil/MEM_CacheLimiter.h
@@ -69,6 +69,8 @@ class MEM_CacheLimiter;
extern "C" {
void MEM_CacheLimiter_set_maximum(size_t m);
size_t MEM_CacheLimiter_get_maximum();
+ void MEM_CacheLimiter_set_disabled(bool disabled);
+ bool MEM_CacheLimiter_is_disabled(void);
};
#endif
@@ -177,8 +179,13 @@ public:
void enforce_limits() {
size_t max = MEM_CacheLimiter_get_maximum();
+ bool is_disabled = MEM_CacheLimiter_is_disabled();
size_t mem_in_use, cur_size;
+ if (is_disabled) {
+ return;
+ }
+
if (max == 0) {
return;
}
diff --git a/intern/memutil/MEM_CacheLimiterC-Api.h b/intern/memutil/MEM_CacheLimiterC-Api.h
index a6a3ec85777..ce7782e3183 100644
--- a/intern/memutil/MEM_CacheLimiterC-Api.h
+++ b/intern/memutil/MEM_CacheLimiterC-Api.h
@@ -53,6 +53,8 @@ typedef bool (*MEM_CacheLimiter_ItemDestroyable_Func) (void*);
#ifndef __MEM_CACHELIMITER_H__
void MEM_CacheLimiter_set_maximum(size_t m);
size_t MEM_CacheLimiter_get_maximum(void);
+void MEM_CacheLimiter_set_disabled(bool disabled);
+bool MEM_CacheLimiter_is_disabled(void);
#endif /* __MEM_CACHELIMITER_H__ */
/**
diff --git a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
index 6156b511f01..f6f1fe419d4 100644
--- a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
+++ b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
@@ -29,6 +29,8 @@
#include "MEM_CacheLimiter.h"
#include "MEM_CacheLimiterC-Api.h"
+static bool is_disabled = false;
+
static size_t & get_max()
{
static size_t m = 32 * 1024 * 1024;
@@ -45,6 +47,16 @@ size_t MEM_CacheLimiter_get_maximum()
return get_max();
}
+void MEM_CacheLimiter_set_disabled(bool disabled)
+{
+ is_disabled = disabled;
+}
+
+bool MEM_CacheLimiter_is_disabled(void)
+{
+ return is_disabled;
+}
+
class MEM_CacheLimiterHandleCClass;
class MEM_CacheLimiterCClass;