From 107e1eef1df3b786ad3ad49fbdb9e058649303b5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 8 Apr 2016 17:07:19 +0200 Subject: patch 7.4.1719 Problem: Leaking memory when there is a cycle involving a job and a partial. Solution: Add a copyID to job and channel. Set references in items referred by them. Go through all jobs and channels to find unreferenced items. Also, decrement reference counts when garbage collecting. --- src/structs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/structs.h') diff --git a/src/structs.h b/src/structs.h index e753860b82..adee3e807e 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1290,6 +1290,8 @@ struct jobvar_S buf_T *jv_in_buf; /* buffer from "in-name" */ int jv_refcount; /* reference count */ + int jv_copyID; + channel_T *jv_channel; /* channel for I/O, reference counted */ }; @@ -1425,11 +1427,12 @@ struct channel_S { job_T *ch_job; /* Job that uses this channel; this does not * count as a reference to avoid a circular - * reference. */ + * reference, the job refers to the channel. */ int ch_job_killed; /* TRUE when there was a job and it was killed * or we know it died. */ int ch_refcount; /* reference count */ + int ch_copyID; }; #define JO_MODE 0x0001 /* channel mode */ -- cgit v1.2.3