aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/dlmalloc.c
AgeCommit message (Collapse)AuthorFilesLines
2022-03-30vppinfra: vector allocator reworkDamjan Marion1-5/+7
- support of in-place growth of vectors (if there is available space next to existing alloc) - drops the need for alloc_aligned_at_offset from memory allocator, which allows easier swap to different memory allocator and reduces malloc overhead - rework of pool and vec macros to inline functions to improve debuggability - fix alignment - in many cases macros were not using native alignment of the particular datatype. Explicitly setting alignment with XXX_aligned() versions of the macro is not needed anymore in > 99% of cases - fix ASAN usage - avoid use of vector of voids, this was root cause of several bugs found in vec_* and pool_* function where sizeof() was used on voids instead of real vector data type - introduce minimal alignment which is currently 8 bytes, vectors will be always aligned at least to that value (underlay allocator actually always provide 16-byte aligned allocs) Type: improvement Change-Id: I20f4b081bb13bbf7bc0ace85cc4e301787f12fdf Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-11-05vppinfra: mspace_get_aligned should respect MALLOC_ALIGNMENTDamjan Marion1-22/+1
While underlying mspace_malloc() respects MALLOC_ALIGNMENT (16) mspace_get_aligned moves start of data for 4 bytes making final result not aligned to MALLOC_ALIGNED. Type: fix Change-Id: Ib1584f315e3658b3b748ebf4886fb7389ce640fe Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-17vppinfra: explicitly export symbolsDamjan Marion1-4/+4
Type: improvement Change-Id: I57a9f85f7df1fc48656b72592349f4c544302f77 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-05vppinfra: address sanitizer: do not instrument dlmalloc internalsBenoît Ganne1-0/+1
Type: fix Change-Id: I8b50777b6ce7df461e5256921591a58e52877628 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-03-22vppinfra: fix typo in dlmalloc.cDave Barach1-1/+1
Fix libffi package name for Ubuntu 20.04 Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Idc567717494b4c40c307f20a40d5e10cd26b0a46
2019-12-17misc: address sanitizer: do not instrument dlmalloc internalsBenoît Ganne1-0/+4
Type: fix Change-Id: I2b8273666db864d80012c39623ae866ac3527426 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-12-17misc: address sanitizer: fix instrumentationBenoît Ganne1-0/+2
Type: fix Change-Id: I99e3951f8cfb7ab9d2f0a7dcee92199eab29043c Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-11-27misc: add address sanitizer heap instrumentationBenoît Ganne1-1/+22
Introduce AddressSanitizer support: https://github.com/google/sanitizers/ This starts with heap instrumentation. vlib_buffer, bihash and stack instrumentation should follow. Type: feature Change-Id: I7f20e235b2f79db72efd0e756f22c75f717a9884 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-06-16vlib: add "memory-trace stats-segment"Dave Barach1-10/+19
Type: feature Change-Id: Ie020fd7e2618284a63efbeb9895068f27c0fb9ab Signed-off-by: Dave Barach <dave@barachs.net>
2019-04-16dlmalloc: honor 8 byte alignment requestsFlorin Coras1-1/+1
Change-Id: Ie504603c2e42cae3ad592952b2b166919420e5f7 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-11vppinfra: fix the issue that mheap_get_trace record wrong pointerWei CHEN1-1/+1
when mspace_get_aligned try to malloc a chunk with align greater than 16 Change-Id: Ic3b91fc9532248482662f019bbfa073da18645ed Signed-off-by: Wei CHEN <weichen@astri.org>
2019-01-02Fixes for buliding for 32bit targets:David Johnson1-16/+15
* u32/u64/uword mismatches * pointer-to-int fixes * printf formatting issues * issues with incorrect "ULL" and related suffixes * structure alignment and padding issues Change-Id: I70b989007758755fe8211c074f651150680f60b4 Signed-off-by: David Johnson <davijoh3@cisco.com>
2018-09-27Trivial: Cleanup some typos.Paul Vinciguerra1-5/+5
This is a new commit for code under a different maintainer. Change-Id: I79fa403fec6a312238a9a4b18b35dbcafaa05439 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-08-24Rename struct mallinfo -> struct dlmallinfoDave Barach1-4/+4
Also: don't #include /usr/include/malloc.h in dlmalloc.h Change-Id: Ic73ff8862cc8aba371488b912255e28dd96374ff Signed-off-by: Dave Barach <dave@barachs.net>
2018-08-23clib_mem_is_heap_object() needs to recognize sys_alloc segmentsDave Barach1-0/+4
Preferably without mistaking -pie (address randomized) segment addresses for heap objects. Change-Id: Idca6b966f14b1caf6b4637843fe407dbc5017535 Signed-off-by: Dave Barach <dave@barachs.net>
2018-08-06dlmalloc compiles errors with clangNeale Ranns1-1/+5
of the form: /home/nranns/Src/vpp/build-data/../src/vppinfra/dlmalloc.c:4327:7: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses] if (!(ms)->magic == mparams.magic) { /home/nranns/Src/vpp/build-data/../src/vppinfra/dlmalloc.c:4696:20: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality] if (((ms)->magic == mparams.magic)) { $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial $ clang --version clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Change-Id: If6d70a87420bd54c8e1b8be1d9e9031f6c699c45 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-07-31Poison freed memory objectsDave Barach1-0/+8
When compiled w/ -DCLIB_DEBUG=1, paint 0x13 across freed memory blocks. Should result in a characteristic SIGSEGV if someone dereferences a pointer in a freed vector element, etc. Change-Id: I5f78970f4342310bfbe7adeddb56feff21f0de2c Signed-off-by: Dave Barach <dave@barachs.net>
2018-07-28session/dlmalloc: coverity fixesFlorin Coras1-1/+2
Change-Id: I17ffec018f5d2fb06a7a3af6d8bc6128ffee3ae6 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-07-27dlmalloc: use static magic constant for debug imagesFlorin Coras1-0/+3
Avoids crashes on restarts if svm root region backing file was not cleaned up. Change-Id: I608cf5711aa8c3f9620900473bdf76bde8b918de Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-07-19Fix coverity warning / legitimate minor bugDave Barach1-1/+1
Of the form "if ((foo & 0x10) == 1)", as opposed to "if (foo & 0x10)" Change-Id: I6a6d276aeed4af7c1c6c78546ee68d598d54d7db Signed-off-by: Dave Barach <dave@barachs.net>
2018-07-18Add config option to use dlmalloc instead of mheapDave Barach1-0/+5098
Configure w/ --enable-dlmalloc, see .../build-data/platforms/vpp.mk src/vppinfra/dlmalloc.[ch] are slightly modified versions of the well-known Doug Lea malloc. Main advantage: dlmalloc mspaces have no inherent size limit. Change-Id: I19b3f43f3c65bcfb82c1a265a97922d01912446e Signed-off-by: Dave Barach <dave@barachs.net>