mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 12:57:42 +00:00
[VM] error: ‘mallinfo mallinfo()’ is deprecated
Apparently libc 2.33 deprecates the mallinfo API in favor of the new mallinfo2 API. The API stays nearly the same, only the types in the struct containing the malloc information has changed. Fields in the new API are size_t instead of int. These changes would allow use of mallinfo2 as a build time configuration on systems that have mallinfo2 available. TEST=cq BUG= Change-Id: Ib074dea3fb1f7c971c2987d8117319bf073ce732 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218161 Reviewed-by: Zach Anderson <zra@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Siva Annamalai <asiva@google.com>
This commit is contained in:
parent
b06b60702b
commit
965333d95c
|
@ -132,6 +132,9 @@ config("dart_config") {
|
|||
defines += [ "DART_USE_TCMALLOC" ]
|
||||
include_dirs += [ "../third_party/tcmalloc/gperftools/src" ]
|
||||
}
|
||||
if (dart_use_mallinfo2) {
|
||||
defines += [ "DART_USE_MALLINFO2" ]
|
||||
}
|
||||
|
||||
if (dart_use_compressed_pointers) {
|
||||
defines += [ "DART_COMPRESSED_POINTERS" ]
|
||||
|
|
|
@ -46,6 +46,10 @@ declare_args() {
|
|||
# the VM enables this only for Linux builds.
|
||||
dart_use_tcmalloc = false
|
||||
|
||||
# Whether to use mallinfo2 instead of mallinfo which is deprecated starting
|
||||
# with libc 2.33
|
||||
dart_use_mallinfo2 = false
|
||||
|
||||
# Whether to link Crashpad library for crash handling. Only supported on
|
||||
# Windows for now.
|
||||
dart_use_crashpad = false
|
||||
|
|
|
@ -341,7 +341,11 @@ bool MallocHooks::Active() {
|
|||
bool MallocHooks::GetStats(intptr_t* used,
|
||||
intptr_t* capacity,
|
||||
const char** implementation) {
|
||||
#if defined(DART_USE_MALLINFO2)
|
||||
struct mallinfo2 info = mallinfo2();
|
||||
#else
|
||||
struct mallinfo info = mallinfo();
|
||||
#endif // defined(DART_USE_MALLINFO2)
|
||||
*used = info.uordblks;
|
||||
*capacity = *used + info.fordblks;
|
||||
*implementation = "tcmalloc";
|
||||
|
|
|
@ -70,7 +70,11 @@ bool MallocHooks::GetStats(intptr_t* used,
|
|||
}
|
||||
#endif
|
||||
#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
|
||||
#if defined(DART_USE_MALLINFO2)
|
||||
struct mallinfo2 info = mallinfo2();
|
||||
#else
|
||||
struct mallinfo info = mallinfo();
|
||||
#endif // defined(DART_USE_MALLINFO2)
|
||||
*used = info.uordblks;
|
||||
*capacity = *used + info.fordblks;
|
||||
*implementation = "unknown";
|
||||
|
|
|
@ -215,6 +215,9 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash):
|
|||
(gn_args['target_cpu'] != 'arm') and
|
||||
sanitizer == 'none')
|
||||
|
||||
# Use mallinfo2 if specified on the command line
|
||||
gn_args['dart_use_mallinfo2'] = args.use_mallinfo2
|
||||
|
||||
if gn_args['target_os'] == 'linux':
|
||||
if gn_args['target_cpu'] == 'arm':
|
||||
# Default to -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're
|
||||
|
@ -490,6 +493,11 @@ def AddCommonGnOptionArgs(parser):
|
|||
'-s',
|
||||
type=str,
|
||||
help='Comma-separated list of arch=/path/to/sysroot mappings')
|
||||
parser.add_argument('--use-mallinfo2',
|
||||
help='Use mallinfo2 to collect malloc stats.',
|
||||
default=False,
|
||||
dest='use_mallinfo2',
|
||||
action='store_true')
|
||||
|
||||
|
||||
def AddCommonConfigurationArgs(parser):
|
||||
|
|
Loading…
Reference in a new issue