Commit Graph

60 Commits

Author SHA1 Message Date
Elyes HAOUAS 47b71d898e Get rid of trailing whitespaces (13 / 14)
Remove trailing whitespaces
Differential Revision: https://phab.enlightenment.org/D12012
2020-06-23 10:31:36 +02:00
Stefan Schmidt 2b8742c0ab modules: eina: chained_pool: check for NULL before passing it to deref
Make sure we check if pool->first_fill is NULL before passing it onwards
where it gets dereferenced. In case this happens return NULL instead of
garbage.

CID: 1293520

Reviewed-by: Christopher Michael <devilhorns@comcast.net>
Differential Revision: https://phab.enlightenment.org/D11980
2020-06-16 17:10:41 +02:00
Cedric BAIL 313796a4f6 eina: introduce a simple malloc near implementation for Chained Mempool.
This actually seems to significantly and reliably improve speed result with
expedite in a higher way than I expected (~10%) which is neat, I guess.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D10537
2019-10-30 08:14:29 -07:00
Cedric BAIL fb5cf01977 eina: introduce an API for requesting memory near already allocated memory from an Eina_Mempool.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D10535
2019-10-30 08:14:27 -07:00
Cedric BAIL 1f445dd12d eina: change default policy of Chained Mempool to recycle memory right away.
Until now, Chained Mempool would first empty its pool and the started to
recycle memory. Now it does always try to recycle first. This should limit
memory fragmentation to some extend.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D10534
2019-10-30 08:14:26 -07:00
Cedric Bail 9382bfc0bc eina: add eina_mempool_iterator_new to slowly iterate every allocated pointer in a mempool.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9941
2019-09-19 14:37:41 -07:00
Cedric Bail 4ab4b59757 eina: fix free support in eina OneBig mempool.
We use an Eina_Trash to store freed pointer, which require the item size
to be at least the size of a pointer. There wasn't any test suite enable
for OneBig mempool and we never used free on a small item size...

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9939
2019-09-17 10:24:05 -07:00
Cedric Bail 2064112684 eina: fix eina_mempool_from to not report pointer that have never been allocated as allocated.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9938
2019-09-17 10:24:03 -07:00
Marcel Hollerbach e43f090265 cmake: remove!
This build was never complete and also was not maintained probebly.

It is also dropped in favour of meson which is cool, merged, works & is fast.

Differential Revision: https://phab.enlightenment.org/D7010
2018-12-20 20:07:26 +01:00
Marcel Hollerbach 46d464e5bf here comes meson
a new shiny buildtool that currently completes in the total of ~ 4 min..
1 min. conf time
2:30 min. build time
Where autotools takes:
1:50 min. conf time
3:40 min. build time.

meson was taken because it went quite good for enlightenment, and is a traction gaining system that is also used by other mayor projects. Additionally, the DSL that is defined my meson makes the configuration of the builds a lot easier to read.

Further informations can be gathered from the README.meson

Right now, bindings & windows support are missing.

It is highly recommented to use meson 0.48 due to optimizations in meson
that reduced the time the meson call would need.

Co-authored-by: Mike Blumenkrantz <zmike@samsung.com>

Differential Revision: https://phab.enlightenment.org/D7012
Depends on D7011
2018-10-02 17:22:50 +02:00
Mike Blumenkrantz f23344733f eina/mempool: remove debug thread check to verify mempool deletion thread
Summary:
a common use case for mempools is that they get created by a thread but then
exist for the duration of the app's lifetime until shutdown() occurs in the
main thread. there is no reason to have an assert here which blocks that
use case
Depends on D6434

Reviewers: ManMower, bu5hm4n, devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6435
2018-06-27 06:18:14 -04:00
Marcel Hollerbach 0609c68e34 eina: only execute that code if HAVE_MALLOC_USABLE_SIZE is defined
thats why we check that ...
2017-12-20 18:11:09 +00:00
Jean Guyomarc'h 96ab58fb8e eina: prevent memory corruption in chained mempool
The chained mempool uses eina trash to dispose and retrieve memory
blobs. Problem is that eina trash requires the memory blobs to be at
least of the size of a pointer. If the size of an element in the mempool
is less than the size of a pointer, which _is_ possible as no minimal
size is enforced, eina_trash will silently corrupt the memory pool.

To prevent memory corruption while still allowing small elements, the
size of an element defaults to the size of a pointer if it was smaller.
This comes at the cost of consuming slightly more memory in these cases,
but at least the memory pool can be safely be used.

@fix
2017-09-16 14:28:39 +02:00
Cedric Bail 743c80ad8b eina: properly mark memory for valgrind before accessing it in one_big mempool. 2017-09-05 17:01:03 -07:00
Amitesh Singh 373e6a0918 eina: fix compilation after b0rking in c9a0237770
Ref T5966
2017-09-05 16:22:33 +09:00
Cedric Bail c9a0237770 eina: properly track valgrind use of the mempool.
T5966
2017-09-04 03:12:57 -07:00
Jean-Philippe Andre d3f2696838 eina: Add EINA_UNUSED in eina_pass_through_from
Fixes a warning
2017-08-21 13:53:28 +09:00
Cedric BAIL 30816a0cf1 eina: add support for from in pass through 2017-08-15 13:46:37 -07:00
Cedric BAIL 04010f7307 eina: add support for from in one big. 2017-08-15 13:46:37 -07:00
Cedric BAIL 5bec2415c9 eina: add support for from in chained mempool. 2017-08-15 13:46:36 -07:00
Gustavo Sverzut Barbieri fa92926469 cmake: major rework of check and pkg-config dependencies.
make FUNC_CHECK(), TYPE_CHECK() and HEADER_CHECK() more general and
they can be set to a scope, like "eina", then all symbols are prefixed
with that. The scope is created with CHECK_INIT(), and
EFL_HEADER_CHECKS_FINALIZE() will finish that.

This makes it possible for cmake/config/eina.cmake +
cmake/post/eina.cmake to add stuff to the generated file, better than
hand edit the template.

CHECK_APPEND_DEFINE(name val) is now the base to add symbols to the
generated file in the current scope.

Then convert cmake/config/eina.cmake to use that and match the
autotools values (were a bit off).

This exposed enabling valgrind was broken due incorrect pkg-config
usage with cmake (it's not obvious), it was using just the libraries,
while LDFLAGS are needed to get -L/usr/lib/valgrind. Then also convert
to CFLAGS provided by pkg-config and make that automatic for
PKG_CONFIG_REQUIRES and PKG_CONFIG_REQUIRES_PRIVATE.

Also, eina-mempool modules use valgrind and must use that now that's
propagating correctly.
2017-01-23 23:55:33 -02:00
Gustavo Sverzut Barbieri 8df6ac453d EflMacros: automatically provide ON;OFF;STATIC option and defines.
Automatically create one option to enable, disable or make it
statically linked into the code, with a define to reflect build type.
2017-01-23 18:23:40 +01:00
Gustavo Sverzut Barbieri 76212a9162 CMake: infra to build modules (static, on or off). 2017-01-23 18:23:40 +01:00
Marcel Hollerbach 88283204c1 build: switch eina to half baked cmake 2017-01-23 18:23:40 +01:00
Carsten Haitzler b7d882515d eina mempool: don't allow 0 sized mempools
there is no point in having a mempool with a max 0 size. this leads to
us mallocing 0 bytes for the base. not good. make minimim size 1. :)

@fix
2016-04-18 09:31:08 +09:00
Daniel Kolesa 03bce14908 eina mp: also include malloc_np.h on FreeBSD 2016-01-07 15:43:26 +00:00
Daniel Kolesa dadc350507 eina mp: only include malloc.h on linux
Elsewhere, everything is in stdlib.h.

@fix
2016-01-07 15:31:59 +00:00
Subodh Kumar 554b2cd9da eina: minimize fragmentation of chainned mempool.
Summary:
Previously: Each allocation happened in the first chain after any free.
Now: All allocation will happen in one chain until all buckets are full, this can reduce
fragmentation to some extent.

Reviewers: seoz, govi, shilpasingh, raster, cedric

Reviewed By: cedric

Subscribers: cedric, rajeshps

Differential Revision: https://phab.enlightenment.org/D2071

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-06 20:19:20 +01:00
Cedric BAIL 938aba36eb eina: do not access dead pointer from within valgrind macro. 2014-01-22 12:22:13 +09:00
Gustavo Sverzut Barbieri dbc4669d68 eina/mp/one_big: fix alignment issues.
When over-allocating (past "pool->max" items) a memory slice will be
allocated to the new item as a linked list using Eina_Inlist.

The original code was placing the Eina_Inlist structure (3 pointers)
at the beginning of the allocated memory. However the item must have
proper alignment based on "pool->item_size", otherwise a structure may
end with unaligned members. Take for example MIPS 32 bits, it uses 4
bytes pointers with 8 bytes double. A structure containing a double
could have it unaligned as 12 % 8 = 4 (12 is the size of Eina_Inlist,
that contains 3 pointers), and MIPS doesn't allow unaligned access.

Albin Tonnerre (Lutin) spotted this in his Debian MIPS test machine,
it was breaking at eet_data_get_double() that was storing an unaligned
double. This was being called from within edje test suite.

The current code will place the list node after the requested
"pool->item_size", of course guaranteeing the pointer inside the node
is aligned (otherwise a "char" or "short" would break its alignment).
2014-01-20 21:44:42 -02:00
Cedric BAIL 1027e7d59c eina: avoid warning. 2013-11-10 12:07:59 +01:00
Cedric BAIL da559ee5d0 eina: use portable infrastructure to detect page size. 2013-11-10 09:26:12 +01:00
Stefan Schmidt ac89c082a4 Revert "Revert "eina: use Eina_Spinlock for Eina_Chained_Mempool.""
Revert now that it is fixed in eina.

This reverts commit 875e7cf74d.
2013-10-11 09:42:49 +01:00
Stefan Schmidt ab0f7ca625 Revert "Revert "Revert "eina: use Eina_Spinlock for Eina_Chained_Mempool."""
Is there a title for the commiter with the longest revert of a revert list?

I screwed this one up. Had other local changes that sneaked in.
Resetting and doing it right now.

This reverts commit ee155b771d.
2013-10-11 09:41:22 +01:00
Stefan Schmidt ee155b771d Revert "Revert "eina: use Eina_Spinlock for Eina_Chained_Mempool.""
You can bet on reverting makes people speed up the process in fixing it.
Revert the revert here now that Cedric fixed it in eina.

This reverts commit 875e7cf74d.
2013-10-11 09:36:35 +01:00
Stefan Schmidt 875e7cf74d Revert "eina: use Eina_Spinlock for Eina_Chained_Mempool."
This patch brings in constant E crash for me. It seems to be timing
related which somehow leads to a mem corruption. Revert it for now
to allow people using E while Cedric looks into it.

This reverts commit 12d34309c7.
2013-10-11 09:18:10 +01:00
Carsten Haitzler 69e27abdc3 eina - and e3fl in general - stop using eina_error_get/set - useless really 2013-10-11 16:50:40 +09:00
Cedric Bail 12d34309c7 eina: use Eina_Spinlock for Eina_Chained_Mempool. 2013-10-11 11:08:17 +09:00
Stefan Schmidt 64c7bd14df eina/mp/one_big: Add a comment to clarify why we do not memset the complete memory.
To avoid people getting confused over this code, like myself, add a comment
to clarify that only the elements need to be set to zero while the payload
does not matter here.
2013-06-14 09:56:55 +01:00
Jérémy Zurcher 1d3fd66860 eina_chained_mempool: typo 2013-06-12 23:34:40 +02:00
Jérémy Zurcher efe5fbb780 eina_chained_mempool: fix ERR arg format 2013-06-12 23:34:40 +02:00
Cedric Bail fa8c469453 eina: align allocated memory to 4096. 2013-04-04 23:50:14 +09:00
Tom Hacohen a35b034b7c Eina mempool: Fixed compilation warning. 2013-03-08 11:46:41 +00:00
Cedric BAIL ab12337d76 eina: forgotten include that borked debug build. 2013-03-04 13:51:26 +09:00
Cedric BAIL 7636dc88c4 eina: try to fix debug build typo.
SVN revision: 83315
2013-01-25 01:20:58 +00:00
Cedric BAIL 5d335bb50b efl/eina: it's really an error, thanks Ulisses.
SVN revision: 83198
2013-01-24 03:54:47 +00:00
Cedric BAIL efa613597d efl/eina: one more typo.
SVN revision: 83197
2013-01-24 03:04:05 +00:00
Cedric BAIL eff597ea1e eina: fix some warning.
SVN revision: 83196
2013-01-24 02:58:00 +00:00
Cedric BAIL b1d856bc8b efl/eina: detect when freeing pointer inside an allocated memory.
SVN revision: 83195
2013-01-24 02:44:14 +00:00
Cedric BAIL 3cfd345a91 efl/eina: simplify mempool logic.
SVN revision: 83194
2013-01-24 02:23:59 +00:00