foonathan/memory

Runtime error: 'allocation node size exceeds supported maximum of allocator'

rushipatel opened this issue · 9 comments

When I run my cross-compiled fastrtps application on the aarch64 linux platform, I see following exception

[foonathan::memory] Allocator foonathan::memory::memory_pool (at 0x559f6319a8) received invalid size/alignment 56, max supported is 48terminate called after throwing an instance of 'foonathan::memory::bad_node_size'
  what():  allocation node size exceeds supported maximum of allocator
Aborted

I have used file container_node_sizes_impl.hpp generated by nodesize_dbg on target platform. The output of the nodesize_dbg from target platform is as following

forward_list:
	1=15
	2=14
	4=12
	8=8
	16=16
list:
	1=23
	2=22
	4=20
	8=16
	16=16
set:
	1=39
	2=38
	4=36
	8=32
	16=32
multiset:
	1=39
	2=38
	4=36
	8=32
	16=32
unordered_set:
	1=23
	2=22
	4=20
	8=16
	16=32
unordered_multiset:
	1=23
	2=22
	4=20
	8=16
	16=32
map:
	1=38
	2=36
	4=32
	8=32
	16=32
multimap:
	1=38
	2=36
	4=32
	8=32
	16=32
unordered_map:
	1=22
	2=20
	4=16
	8=16
	16=32
unordered_multimap:
	1=22
	2=20
	4=16
	8=16
	16=32
shared_ptr_stateless:
	1=24
	2=24
	4=24
	8=24
	16=32
shared_ptr_stateful:
	1=32
	2=32
	4=32
	8=32
	16=48

Build method

# 1) Cross-compile `nodesize_dbg`, run it on the target and get `container_node_sizes_impl.hpp`
# 2) Cross-compile memory
  cmake \
    -DFOONATHAN_MEMORY_CONTAINER_NODE_SIZES_IMPL=./container_node_sizes_impl.hpp \
    -DCMAKE_TOOLCHAIN_FILE="/code/cross_compile/linux_toolchain.cmake" \
    ..

Toolchain file

set(CMAKE_SYSTEM_PROCESSOR "aarch64")
set(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc-7")
set(CMAKE_CXX_COMPILER "/usr/bin/aarch64-linux-gnu-g++-7")
set(CMAKE_FIND_ROOT_PATH "/usr/aarch64-linux-gnu")
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_HOST_LINUX ON)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

How are you creating the pool and what do you allocate with it?

It looks like an issue from the application side. I'm working on debugging it and will provide more info as I find. I'll leave the issue closed for now.

The -DFOONATHAN_MEMORY_CONTAINER_NODE_SIZES_IMPL is only applicable to QNX platform and so passing this flag was not effective. The node size info was not used by memory and caused FastDDS to use custom node size implementation. The segfault occurs at line 230 of RTPSReader.cpp for the map<GUID_t, uint16_t> object.

The fix was simple, manually copy container_node_sizes_impl.hpp to src/ under the build directory.

Wait, so what container_node_sizes_impl.hpp was used?

I encountered the same problem, how can I solve it?

hello ,when i run ./HelloWorldExample subscriber && ./HelloWorldExample publisher
i encounter the error . i use cross compile ,then place the binary HelloWorldExample on ARM.
[foonathan::memory] Allocator foonathan::memory::memory_pool (at 0x18b19dd8) received invalid size/alignment 56, max supported is 48
terminate called after throwing an instance of 'foonathan::memory::bad_node_size'
what(): allocation node size exceeds supported maximum of allocator
Aborted (core dumped)

can you tell me how to fix it .
please contact me 811149649@qq.com or wechat 18811396527

This is an issue with Fast-DDS, which will be resolved by the referenced PR.

Has there been any resolution on this issue? Which version of foonthan memory should be used with the latest release of Fast-DDS?

@stewy-lewy-TR The latest release of Fast-DDS is nightly tested with release v0.7-1 of this repo.