Skip to content

Commit 35b0bc8

Browse files
committed
---
yaml --- r: 53087 b: refs/heads/dist-snap c: 1a41b48 h: refs/heads/master i: 53085: 3fe5931 53083: 3a76131 53079: 3a18055 53071: 05e3098 53055: e17351d v: v3
1 parent 15610bf commit 35b0bc8

File tree

5 files changed

+6
-19
lines changed

5 files changed

+6
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 2e0614750c398c9aac2f4064addb2fa95ba32282
10+
refs/heads/dist-snap: 1a41b484bf05514f469e69efd56fcd7039d34db9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/rt/memory_region.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ memory_region::realloc(void *mem, size_t orig_size) {
121121
}
122122

123123
void *
124-
memory_region::malloc(size_t size, const char *tag, bool zero) {
124+
memory_region::malloc(size_t size, const char *tag) {
125+
# if RUSTRT_TRACK_ALLOCATIONS >= 1
125126
size_t old_size = size;
127+
# endif
126128
size += HEADER_SIZE;
127129
alloc_header *mem = (alloc_header *)::malloc(size);
128130
if (mem == NULL) {
@@ -143,18 +145,9 @@ memory_region::malloc(size_t size, const char *tag, bool zero) {
143145
void *data = get_data(mem);
144146
claim_alloc(data);
145147

146-
if(zero) {
147-
memset(data, 0, old_size);
148-
}
149-
150148
return data;
151149
}
152150

153-
void *
154-
memory_region::calloc(size_t size, const char *tag) {
155-
return malloc(size, tag, true);
156-
}
157-
158151
memory_region::~memory_region() {
159152
if (_synchronized) { _lock.lock(); }
160153
if (_live_allocations == 0 && !_detailed_leaks) {

branches/dist-snap/src/rt/memory_region.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ class memory_region {
7777
public:
7878
memory_region(rust_env *env, bool synchronized);
7979
memory_region(memory_region *parent);
80-
void *malloc(size_t size, const char *tag, bool zero = true);
81-
void *calloc(size_t size, const char *tag);
80+
void *malloc(size_t size, const char *tag);
8281
void *realloc(void *mem, size_t size);
8382
void free(void *mem);
8483
~memory_region();

branches/dist-snap/src/rt/rust_stack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ check_stack_canary(stk_seg *stk) {
5858
stk_seg *
5959
create_stack(memory_region *region, size_t sz) {
6060
size_t total_sz = sizeof(stk_seg) + sz;
61-
stk_seg *stk = (stk_seg *)region->malloc(total_sz, "stack", false);
61+
stk_seg *stk = (stk_seg *)region->malloc(total_sz, "stack");
6262
memset(stk, 0, sizeof(stk_seg));
6363
stk->end = (uintptr_t) &stk->data[sz];
6464
add_stack_canary(stk);

branches/dist-snap/src/rt/rust_task.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,6 @@ rust_task::backtrace() {
450450
#endif
451451
}
452452

453-
void *
454-
rust_task::calloc(size_t size, const char *tag) {
455-
return local_region.calloc(size, tag);
456-
}
457-
458453
size_t
459454
rust_task::get_next_stack_size(size_t min, size_t current, size_t requested) {
460455
LOG(this, mem, "calculating new stack size for 0x%" PRIxPTR, this);

0 commit comments

Comments
 (0)