Commit Graph

210 Commits

Author SHA1 Message Date
Campbell Barton
1a6b364c28 should fix builds for osx 2013-08-28 11:22:29 +00:00
Campbell Barton
d1d6a13297 include slop-space in debug statistics (gcc/clang only) 2013-08-28 10:17:26 +00:00
Campbell Barton
b97334f992 add GPL header to treehash.c and add missing includes to cmake. 2013-08-24 03:17:28 +00:00
Sergey Sharybin
c0f8e15295 Speedup for guarded allocator
- Re-arrange locks, so no actual memory allocation
  (which is relatively slow) happens from inside
  the lock. operation system will take care of locks
  which might be needed there on it's own.

- Use spin lock instead of mutex, since it's just
  list operations happens from inside lock, no need
  in mutex here.

- Use atomic operations for memory in use and total
  used blocks counters.

This makes guarded allocator almost the same speed
as non-guarded one in files from Tube project.

There're still MemHead/MemTail overhead which might
be bad for CPU cache utilization
2013-08-19 10:51:40 +00:00
Sergey Sharybin
018ab045e3 Added check for whether thread lock is being removed while thread is using guarded alloc.
--
svn merge -r58788:58789 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:38:27 +00:00
Sergey Sharybin
58d7ae891d Blender might be compiled without guardedalloc again
This is useful for benchmark tests, to make CPU cache
utilization as good as we could with current design.
2013-08-15 07:36:56 +00:00
Campbell Barton
ce2e2b141e use gcc malloc attribute for low level allocation functions, prevents gcc from checking if resulting pointers alias existing pointers, also use sentinel attribute for uiButGetStrInfo so incorrect usage gives a warning. 2013-08-05 20:57:13 +00:00
Campbell Barton
bd89bd9e1c avoid using MEM_reallocN_id directly, add utility macro for freeing. 2013-08-04 03:00:04 +00:00
Campbell Barton
2a8d76d734 add versions of MEM_reallocN, MEM_recallocN which take a string arg so new allocs have an ID, changing existing functions signatures would be too disruptive at the moment. 2013-08-03 17:53:41 +00:00
Campbell Barton
a6b505ef0b style cleanup 2013-06-06 06:02:46 +00:00
Campbell Barton
7068a5eba7 tweak to recent commit, don't show keymap in menu tooltips. 2013-06-02 15:58:43 +00:00
Brecht Van Lommel
fe02323632 Fix to actually disable DEBUG_BACKTRACE by default. 2013-05-31 12:36:35 +00:00
Sergey Sharybin
1be2936298 Backtrace for unfreed memory blocks
Added an option to show backtrace from where
non-freed datablock was allocated from.

To enable this feature, simply enable DEBUG_BACKTRACE
in mallocn.c file and all unfreed datablocks will
be followed up by a backtrace.

Currently works on linux and osx only,
windows support is on TODO.

This feature is for sure disabled by default,
so does not affect any builds which don't
explicitly define DEBUG_BACKTRACE.
2013-05-30 14:27:24 +00:00
Campbell Barton
225c5fee6b move BLO_sys_types.h -> BLI_sys_types.h (it had nothing todo with loading)
remove MEM_sys_types.h which was a duplicate.
2013-05-28 19:35:26 +00:00
Brecht Van Lommel
bc0e3ffc0c Fix build error after removing return value from MEM_freeN. 2013-05-21 10:13:42 +00:00
Campbell Barton
cd6b27f2b5 remove return value from MEM_freeN, it wasn't used anywhere and was cast to a different function signature. (which evidently works but error prone). 2013-05-21 07:37:59 +00:00
Campbell Barton
7b707fff56 correct assert for driver evaluation,
also add asserts for listbase functions when the list is NULL, and use noreturn attribute for jpeg_error.
2013-05-12 05:54:33 +00:00
Campbell Barton
7d4eee2b18 add option to disable guardedalloc, helps for debugging memory errors
since guardedalloc confuses them.

The option cases a warning on build, since its ownly for experimental
use.
2013-05-08 12:55:23 +00:00
Campbell Barton
10b4a86dbf code cleanup: quiet warnings building with mingw. 2013-03-29 00:50:52 +00:00
Campbell Barton
655ed9cc7f style cleanup 2013-03-18 11:44:56 +00:00
Thomas Dinges
431619e45b Windows compile fix:
* r54117 broke Windows, __func__ not declared.
2013-01-27 15:12:52 +00:00
Campbell Barton
9d36fade8f make MEM_reallocN and MEM_recallocN behave as libc's realloc() - alloc when receiving a NULL value. 2013-01-27 11:20:50 +00:00
Sergey Sharybin
5e739ddae2 Added some code which helps troubleshooting issues caused by
non-threadsafe usage of guarded allocator.

Also added small chunk of code to check consistency of begin/end
threaded malloc.

All this additional checks are commented and wouldn't affect on
builds, however found them helpful to troubleshoot issues so
decided to commit it to SVN.
2013-01-24 08:14:05 +00:00
Sergey Sharybin
6571713ddb Ambient occlusion baker from multi-resolution mesh
This implements AO baking directly from multi-resolution mesh with much
less memory overhead than regular baker.

Uses rays distribution implementation from Morten Mikkelsen, raycast
is based on RayObject also used by Blender Internal.

Works in single-thread yet, multi-threading would be implemented later.
2012-12-18 17:46:42 +00:00
Bastien Montagne
ab2c273b12 Added GPL header to sconscripts!
Also changed shebang to '#!/usr/bin/env python', this is more portable across unixes...
2012-12-17 08:01:43 +00:00
Campbell Barton
60808c5ed6 disable openmp thread assert, would fail in cases where the caller was locking for its self (sculpt mode) 2012-12-13 10:37:04 +00:00
Campbell Barton
21a2660290 assert in debug builds if MEM_ alloc's are called in openmp threads.
note: the caller can do locking to prevent errors - but this isn't being done in blender yet, so this prevents accidental allocs in openmp for now.
2012-12-12 04:41:23 +00:00
Sergey Sharybin
a8905364c3 Typo fix in comment. No functional changes. 2012-11-28 09:49:26 +00:00
Campbell Barton
936f0388e8 code cleanup: some warnings and formatting for PyMethodDef's in the BGE. 2012-11-10 05:42:50 +00:00
Campbell Barton
fbe13ab84a style cleanup 2012-09-20 12:29:28 +00:00
Campbell Barton
aaafa0c2fe code cleanup: move file string defines into BLI_path_utils.h, BKE_utildefines is now unused but keep incase we want to add defines there later. 2012-09-03 22:04:14 +00:00
Campbell Barton
9a776daca8 code cleanup: vfont's used confusing and over complicated method of storing memory for loaded fonts, not store as a temp var in the fonts. 2012-08-21 10:39:02 +00:00
Campbell Barton
b96c622015 style cleanup 2012-08-11 22:12:32 +00:00
Campbell Barton
51182bc78d add MEM_recallocN(), so bytes are ensured to be zero'd when growing. 2012-08-11 12:16:09 +00:00
Campbell Barton
7fd1bd18e5 fix crash when polling image sample outside image space.
also remove historic comment which isnt helpful.
2012-08-01 14:29:24 +00:00
Brecht Van Lommel
aac3f0eaeb Fix warnings on old apple GCC compiler due to no support for alloc_size attribute. 2012-07-31 15:05:09 +00:00
Sergey Sharybin
3337887fd1 Debug option for guarded allocation: store name of original datablock
when using MEM_dupallocN. This helps figuring out issues with non-freed
dup_alloc blocks,

Simply enable DEBUG_MEMDUPLINAME in mallocn.c file.
2012-07-24 15:17:03 +00:00
Campbell Barton
e4cfcdc3a6 header comment cleanup, explain whats the difference between confusingly named drarnode.c and node_draw.c. 2012-07-14 15:29:45 +00:00
Campbell Barton
98520ce4de use gcc attributes for BLI alloc functions 2012-07-14 12:47:49 +00:00
Bastien Montagne
4c6abb8105 Fix for error from grumpy gcc in "over-warning" mode. Must explicitely cast uintptr_t to unsigned int (othe solution would be to use PRIuPTR macro from inttypes.h, but that would probably causes some problems with windows...). 2012-07-08 15:48:47 +00:00
Campbell Barton
76629c11ae correct use of __attribute__((nonnull)) 2012-07-08 15:11:13 +00:00
Campbell Barton
b91bc4f037 use gcc attrubutes to warn on unused return values and arguments which shouldnt be NULL.
also remove IDP_AppendArray's return value which wasnt the new item in the array (which is odd/misleading), but wasnt used anywhere either.
2012-07-08 06:00:27 +00:00
Campbell Barton
1d29ee0d3b use alloc_size attribute for guarded alloc functions with gcc. 2012-07-08 03:15:37 +00:00
Campbell Barton
c8c743b609 code cleanup: compile with clang and quiet some warnings. 2012-06-28 12:32:06 +00:00
Campbell Barton
a89d551a1c committed debug memcount by accident 2012-06-27 22:27:04 +00:00
Campbell Barton
a09feb7386 option so operators can be executed with undo enabled (and redo). 2012-06-27 21:41:17 +00:00
Campbell Barton
d008807a2d style cleanup: header comments, use more doxy compat formatting 2012-06-27 17:48:39 +00:00
Brecht Van Lommel
ae797383b7 Guardedalloc/C++: delete is valid on a NULL pointer, add a check so MEM_freeN
doesn't print warning messages.
2012-06-25 11:43:12 +00:00
Campbell Barton
3c8a4c458b more guardedalloc use in C++, also make compositorMutex a static var, was allocated and never freed. 2012-06-25 10:35:24 +00:00
Campbell Barton
cc0784c1b9 optionally use guarded alloc for tiles compositor, also replace allocation functions with a macro. 2012-06-25 09:14:37 +00:00