Commit Graph

74 Commits

Author SHA1 Message Date
62c8f46ab6 Docs: comment functions in BLI & Py API 2015-08-05 02:09:03 +10:00
b707b07c5b Fix mempool bottleneck alloc & freeing a single item
Would continuously reinitialize the first chunk of the mempool,
now check for at least 2 blocks.
2014-06-08 23:09:30 +10:00
f700a13eb5 Revert "Mempool: simplify memory chunk list building"
This reverts commit c82371fc06.

Caused regression in iterator
2014-04-10 11:35:17 +10:00
82628a6b0e Code cleanup: use struct type for mempool & style edits 2014-04-10 06:49:25 +10:00
c82371fc06 Mempool: simplify memory chunk list building 2014-04-08 13:41:57 +10:00
412826a504 Mempool: delay allocating an initial chunk, its not always used 2014-04-08 12:58:56 +10:00
5c5d643938 Mempool: use define for used freeword and correct define 2014-04-07 12:52:23 +10:00
13d90ab8f7 Mempool: minor optimization to building free pointer list 2014-04-07 12:38:32 +10:00
aee82b4b2c Mempool: fix own error in recent commit
chunks must be added in order for iteration.
2014-04-07 12:38:32 +10:00
19b7bb5975 Optimize mempool: round chunk size to powers of 2, account for slop-space
This helps to reduce memory fragmentation.
2014-04-05 12:14:05 +11:00
af59ee340f Mempool: remove BLI_MEMPOOL_SYSMALLOC, MEM_* allocs are more efficient now 2014-04-05 12:14:05 +11:00
70353f833a Optimize mempool: replace double linked list with single for memory chunks 2014-04-05 09:49:13 +11:00
7cb90a611f Optimization for mempool initial chunk allocation
Almost all pools allocated 2 chunks on initialization,
every element needed to be added to the free-list which
would never be used for small pools.

Now allocate only one, gives minor speedup for some bmesh operations.
2014-04-04 21:25:08 +11:00
b3afbcab8f ListBase API: add utility api funcs for clearing and checking empty 2014-02-08 06:24:05 +11:00
737e51cb21 Mempool/Memarena: hint for unlikely conditions 2013-12-10 21:28:52 +11:00
c005fb407b Util-defines: avoid multiple calculation/access for MIN/MAX macros 2013-12-08 17:29:22 +11:00
7c8c49a34a style cleanup 2013-10-21 23:35:08 +00:00
6631d4ddd5 Build fix (issue could happen with scons,reported by ebrain on IRC, thanks).
Var declared in an #ifdef DEBUG, but used in an #ifndef NDEBUG…
2013-10-07 07:39:58 +00:00
48013e8a9c more corrections to valgrind hinting. 2013-10-05 04:59:43 +00:00
2621d77f39 use valgrind hints for memarena for better debugging info when using valgrind.
also quiet a false positive in BLI_mempool_free().
2013-10-05 04:38:08 +00:00
f5eb880358 freeing mempool elements now fills freed memory with --debug for debug builds. 2013-10-03 14:44:33 +00:00
9b1be7ce93 add cmake option WITH_MEM_VALGRIND, helps to track down errors with mempool use which sometimes only show up as bugs in very rare cases (because even though the element is freed, the chunk is still allocated). 2013-10-03 12:22:44 +00:00
2dc988df8c reorder BLI_strict_flags.h include so its not conflicting with stdio.h on apple. 2013-09-03 04:39:12 +00:00
1ea9f88ff9 warning cleanup: correct some odd returns and quiet strict flag warnings on some systems. 2013-09-02 17:59:04 +00:00
2924a02a35 move strict compiler checks into a header so its easier to manage in one place (pragmas were copied around).
also enable more strict warnings for BLF (which had some incorrect casts).
2013-09-01 00:46:04 +00:00
8e46cf637c tweak mempool loop comparisons when we know there is no chance for skipping past the last value.
also correct typo.
2013-08-31 02:12:31 +00:00
f477c0e535 remove unnecessary check in BLI_mempool_iterstep and add doxygen comments to mempool. 2013-08-30 22:04:37 +00:00
b8547074e1 mempool internal change, use unsigned ints where possible (less overhead),
also quiet compiler warning for BLI_LINKSTACK_FREE macro.
2013-08-30 21:32:57 +00:00
8ef934c73f ghash/bli-listbase edits, rename BLI_ghash_pop -> BLI_ghash_popkey (since it takes a key as an arg and isnt popping any element from the hash as you might expect).
add BLI_pophead/tail, since getting the first element from a list and removing it is a common task.
2013-08-26 23:37:08 +00:00
e2bd3a4644 clearing the mempool can now keep more then a single element reserved. 2013-08-25 16:16:38 +00:00
28243b2e5f fix leak in BLI_ghash_clear(). was never freeing entries, add BLI_mempool_clear utility function. 2013-08-25 14:58:26 +00:00
e4d278668f code cleanup for mempool, refactor chunk initialization into a static function. 2013-08-25 14:50:40 +00:00
a476459c5e merge mempool allocs per chunk, include the data in the BLI_mempool_chunk alloc. 2013-08-25 13:15:22 +00:00
89c7cf1a49 style cleanup: also use ARRAY_HAS_ITEM macro for mempool check 2013-08-21 02:29:13 +00:00
bec9bcc14c Added check for address being freed by mempool free
When blender is built in debug mode, BLI_mempool_free will
ensure address passed to the function actually belongs to
this pool.

--
svn merge -r58710:58711 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:18:25 +00:00
2497084744 mempool api cleanup: differentiate mempool functions that allocate a pointer lookup table from allocating the data as a contiguous array,
call these functions BLI_mempool_as_table(), BLI_mempool_as_array(), the N prefixed versions of these functions return newly allocated arrays.
2013-08-04 19:40:50 +00:00
66a4077927 fix for [#36260] 2,300 Objects Makes Blender Unresponsive
- performance of outliner was low because of unoptimal data structures.
- now it uses BLI_mempool instead of custom mempool and GHash to make searches for duplicates faster.
- also fix undesired behaviour of BLI_mempool_as_arrayN

thanks to Campbell Barton and Lukas Tönne for helping me get a better fix put together.
2013-08-03 11:35:09 +00:00
bc5ecbc393 optimization: avoid extra loop in BLI_mempool_destroy(). free the list inline. 2013-07-19 10:40:57 +00:00
1fb980e7df reduce sign conversion comparisons for smallhash and tweak warnings elsewhere. 2013-06-22 20:20:06 +00:00
Dalai Felinto
d23bf09712 build fix for old gccs (after rev.57620)
enabling the new pragmas only when gcc >= 4.6
gcc 4.2.1 here (OSX)
2013-06-22 20:00:17 +00:00
2efea8cf03 reduce sign comparisons for ghash and add more strict warnings for gcc. 2013-06-20 19:39:29 +00:00
3b341068ba warn of sign conversions for low level apis - ghash, heap, mempool 2013-05-08 12:55:51 +00:00
34805a4752 BLI_mempool totalloc was being used un-initialized, normally this would cause bugs but turns out its not used,
ifdef'd it out but keep in the struct in BLI_mempool for now.
2013-02-17 05:16:48 +00:00
f46ca7836d add debug check for mempool double free (or misuse of BLI_MEMPOOL_ALLOW_ITER),
some reports in the tracker show errors on bmesh iteration which could be caused by this.
2013-02-15 04:14:53 +00:00
00025c74b4 add BLI_mempool_as_arrayN utility function for getting the mempool as a new array (utility function currently unused). 2013-01-30 21:17:09 +00:00
9a4da5a2f1 utility function to get a mempool as a pointer array. 2013-01-19 03:51:17 +00:00
bf355362b1 replace error prints with asserts in BLI_mempool when an iterator function is called on a non-iterator flagged pool. 2013-01-19 03:16:52 +00:00
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
bddc7dfc20 style cleanup: remaining BLI files. 2012-05-12 15:13:06 +00:00
4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00