Skip to content

Commit

Permalink
DEBUG: Extra check for fast heap range check
Browse files Browse the repository at this point in the history
  • Loading branch information
nickva committed Feb 5, 2024
1 parent 074715d commit e0cd2e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions erts/emulator/beam/erl_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,13 +1676,14 @@ erts_check_circular_offheap(Process *p)
slow = fast = p->off_heap.first;

while (fast) {
if(ErtsInBetween(fast, p->htop, p->hend)) return 1;
fast = fast->next;
if (fast == slow) return 0;
if (fast == slow) return 2;

if (++cnt & 1) {
slow = slow->next;
}
}

return 1;
return 0;
}
2 changes: 1 addition & 1 deletion erts/emulator/beam/erl_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ int erts_check_circular_offheap(Process *p);
erts_check_circular_offheap(P); \
} while (0)
#else
# define ERTS_CHK_MBUF_SZ(P) ERTS_ASSERT(erts_check_circular_offheap(P))
# define ERTS_CHK_MBUF_SZ(P) ERTS_ASSERT((erts_check_circular_offheap(P)==0))
#endif

#define ERTS_FOREACH_SIG_PRIVQS(PROC, MVAR, CODE) \
Expand Down
2 changes: 1 addition & 1 deletion erts/emulator/beam/erl_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -13360,7 +13360,7 @@ erts_proc_exit_handle_dist_monitor(ErtsMonitor *mon, void *vctxt, Sint reds)
hp = erts_produce_heap(&factory, watcher_sz, 0);
ERTS_CHK_MBUF_SZ(c_p);
watcher = copy_struct(watcher, watcher_sz, &hp, factory.off_heap);
if(!erts_check_circular_offheap(c_p)) {
if(erts_check_circular_offheap(c_p)) {
fflush(stdout);
fflush(stderr);
fprintf(stderr, "XXXXX %s:%s:%d \n", __FILE__, __func__, __LINE__);
Expand Down

0 comments on commit e0cd2e7

Please sign in to comment.