Skip to content

Commit 51076bf

Browse files
committed
Drop at-exit memory leak assertion and note accuracy requirements
1 parent e696c6f commit 51076bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

java_strings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ class CommonBase {
197197
void __attribute__((destructor)) check_leaks() {
198198
size_t alloc_count = 0;
199199
size_t alloc_size = 0;
200+
fprintf(stderr, "The following LDK-allocated blocks still remain.\\n");
201+
fprintf(stderr, "Note that this is only accurate if System.gc(); System.runFinalization()\\n");
202+
fprintf(stderr, "was called prior to exit after all LDK objects were out of scope.\\n");
200203
for (allocation* a = allocation_ll; a != NULL; a = a->next) {
201204
fprintf(stderr, "%s %p (%lu bytes) remains:\\n", a->struct_name, a->ptr, a->alloc_len);
202205
backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
@@ -205,7 +208,8 @@ class CommonBase {
205208
alloc_size += a->alloc_len;
206209
}
207210
fprintf(stderr, "%lu allocations remained for %lu bytes.\\n", alloc_count, alloc_size);
208-
DO_ASSERT(allocation_ll == NULL);
211+
fprintf(stderr, "Note that this is only accurate if System.gc(); System.runFinalization()\\n");
212+
fprintf(stderr, "was called prior to exit after all LDK objects were out of scope.\\n");
209213
}
210214
"""
211215
self.c_file_pfx = self.c_file_pfx + """

0 commit comments

Comments
 (0)