Skip to content

Commit 57f08e1

Browse files
committed
Only call malloc_usable_size under linux
under OSX `malloc_size` should have the same functionality.
1 parent b1e6f49 commit 57f08e1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/memory-analyzer/gdb_api.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,15 @@ gdb_apit::~gdb_apit()
5959

6060
size_t gdb_apit::query_malloc_size(const std::string &pointer_expr)
6161
{
62+
#ifdef __linux__
6263
write_to_gdb("-var-create tmp * malloc_usable_size(" + pointer_expr + ")");
64+
#elif __APPLE__
65+
write_to_gdb("-var-create tmp * malloc_size(" + pointer_expr + ")");
66+
#else
67+
// Under non-linux/OSX system we simple return 1, i.e. as if the \p
68+
// pointer_expr was not dynamically allocated.
69+
return 1;
70+
#endif
6371

6472
if(!was_command_accepted())
6573
{

0 commit comments

Comments
 (0)