bother splitting. This greatly simplifies the logic, trims another 4% off the
fast path, and doesn't actually affect the results at all because of the way we
pad for alignment anyways.
svn path=/trunk/; revision=51216
if the right-hand merge target was there originally. This brings memory usage
down another ~40% when running the heavy test suite.
This also lets us extract the master-list check out of unfree() since it is now
only relevant at a single caller, and turns unfree into the more understandable
remove_from_recycler().
svn path=/trunk/; revision=51104
Removes one branch from the hot path, deduplicates one function call in the cold
path by effectively falling through, and makes it more obvious what the code is
actually trying to do.
svn path=/trunk/; revision=51013
Move a few assignments around to avoid one extra subtraction. I suspect having
the two if statements next to each other is friendly to the compiler's optimizer
as well.
Shaves ~1.3% off my timing tests, bringing the new design *very* close to the
old one in raw allocation speed.
svn path=/trunk/; revision=50961
unobtrusive if statement got dropped. Without it the allocator exhibits the old
bad behaviour of 3x memory usage and heavy fragmentation.
We want it back, thank you very much.
svn path=/trunk/; revision=50960
What was becoming apparent as more dissectors started using wmem was that the
old block allocator design had issues with memory fragmentation. This keeps the
same underlying memory layout, but completely changes how free blocks are kept.
It runs about 3% slower in my tests (still an order of magnitude faster than
g_malloc) but uses about 1/3 the memory.
I suspect some simple optimizations could reclaim that 3% as well - the design
is fast, but I did not code particularly for speed.
Thoroughly tested with the existing test suite (which caught half a dozen bugs
in my first draft) so it should actually work!
svn path=/trunk/; revision=50955
actual wmem_allocator_t structure. This simplifies the internal API and
deduplicates a few alloc/free calls in the individual allocator implementations.
I'd originally made the allocators responsible for this on purpose with the
idea that they'd be able to optimize something clever based on the type of
allocator, but that's clearly more work and complexity than it's worth given
the small number of allocators we create/destroy.
svn path=/trunk/; revision=49512
reason).
Don't use g_assert_cmpuint, since it apparently causes warnings on windows that
I don't know how to get rid of safely without breaking the conditions being
checked.
svn path=/trunk/; revision=48575
assertions in the block allocator, and fix one rare potential underflow caught
by the improved tests.
The tests now take ~200MB and 5-10 seconds to run. Hopefully this is small
enough for the build-bots to handle, if not then we can reduce the max
allocation size or max iterations to suit.
svn path=/trunk/; revision=48574
failing. I suspect it has to do with my lack of understanding of glib's unit
test framework, not the code being tested.
svn path=/trunk/; revision=48519
from one case I consistently forgot when typing it up originally, even though
it's clearly listed several places in my design notes.
Also include an #if0-ed out block of code to redirect emem to wmem for easy
testing (since there are very few common dissectors that use wmem right now).
svn path=/trunk/; revision=48434
Re-enable the block allocator by default in trunk since it is much better
tested now - I've spent some time with a hack redirecting all emem allocations
to wmem, so it's seen a lot of traffic. I will still likely turn it off for
1.10 whenever that branches, just to be safe.
svn path=/trunk/; revision=48416
multiple adjacent free chunks. When splitting a used chunk, the resulting
extra unused chunk may need to be merged to its right.
svn path=/trunk/; revision=47552
Some interesting algorithmic stuff going on in here for those who are
interested.
This completes the allocator rewrites for the API additions, so those can be
exposed now.
svn path=/trunk/; revision=47547