Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Correct struct packing in _tracemalloc.c
  • Loading branch information
emmatyping committed May 11, 2018
commit de45e32745826001354fbf408fc64ca5bf7c3541
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,7 @@ Václav Šmilauer
Allen W. Smith
Christopher Smith
Eric V. Smith
Ethan Smith
Gregory P. Smith
Mark Smith
Nathaniel J. Smith
Expand Down
13 changes: 10 additions & 3 deletions Modules/_tracemalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ static PyThread_type_lock tables_lock;

#define DEFAULT_DOMAIN 0

/* Pack the frame_t structure to reduce the memory footprint. */
/* Pack the pointer_t structure to reduce the memory footprint. */
#if defined(_MSC_VER)
#pragma pack(push, 4)
#endif
typedef struct
#ifdef __GNUC__
__attribute__((packed))
Expand All @@ -76,14 +79,18 @@ __attribute__((packed))
uintptr_t ptr;
unsigned int domain;
} pointer_t;
#ifdef _MSC_VER
#pragma pack(pop)
#endif

/* Pack the frame_t structure to reduce the memory footprint on 64-bit
architectures: 12 bytes instead of 16. */
#if defined(_MSC_VER)
#pragma pack(push, 4)
#endif
typedef struct
#ifdef __GNUC__
__attribute__((packed))
#elif defined(_MSC_VER)
#pragma pack(push, 4)
#endif
{
/* filename cannot be NULL: "<unknown>" is used if the Python frame
Expand Down