RFR: 8369393: NMT: poison the malloc header and footer under ASAN build [v2]
Johan Sjölen
jsjolen at openjdk.org
Wed Dec 17 09:02:24 UTC 2025
On Tue, 2 Dec 2025 10:21:16 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> src/hotspot/share/nmt/mallocHeader.cpp line 80:
>>
>>> 78: }
>>> 79:
>>> 80: MallocHeader* MallocHeader::kill_block(void* memblock) {
>>
>> Put these functions in the inline file instead, seems unnecessary to not get inlining of these calls.
>
> These functions are not templated. When put them in inline file, the definitions will be repeated for every cpp that include the inline file. There are 3 instances of these cpp files. Then, linker complains about duplicate definitions.
Did you ensure the header declarations are declared inline?
$ cat inline.hpp
#ifndef header
#define header
inline void foo();
#endif
$ cat inline.inline.hpp
#include "inline.hpp"
#include <cstdio>
#ifndef inlheader
#define inlheader
void foo() {
printf("Inline definition");
}
#endif
$ cat a.cpp
#include "inline.inline.hpp"
#include "a.hpp"
void bar() {
foo();
}
$ cat b.cpp
#include "b.hpp"
#include "inline.inline.hpp"
void baz() {
foo();
}
$ cat main.cpp
#include "b.hpp"
#include "a.hpp"
int main() {
baz();
bar();
return 0;
}
$ g++ -c main.cpp -o main.o
$ g++ -c a.cpp -o a.o
$ g++ -c b.cpp -o b.o
$ g++ *.o -o myprogram
$ ./myprogram
Inline definitionInline definition
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28503#discussion_r2584107717
More information about the hotspot-runtime-dev
mailing list