FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-33351: Correct struct packing in _tracemalloc.c by emmatyping · Pull Request #6761 · python/cpython · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Add struct packing for pointer_t and fix struct packing under clang-cl for
frame_t.

Patch by Ethan Smith
13 changes: 10 additions & 3 deletions Modules/_tracemalloc.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL