aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index a65dbb48b93..f57e22d9cc0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2837,6 +2837,19 @@ vector_nbytes (struct Lisp_Vector *v)
2837 return vroundup (size); 2837 return vroundup (size);
2838} 2838}
2839 2839
2840/* Release extra resources still in use by VECTOR, which may be any
2841 vector-like object. For now, this is used just to free data in
2842 font objects. */
2843
2844static void
2845cleanup_vector (struct Lisp_Vector *vector)
2846{
2847 if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT)
2848 && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK)
2849 == FONT_OBJECT_MAX))
2850 ((struct font *) vector)->driver->close ((struct font *) vector);
2851}
2852
2840/* Reclaim space used by unmarked vectors. */ 2853/* Reclaim space used by unmarked vectors. */
2841 2854
2842static void 2855static void
@@ -2871,6 +2884,7 @@ sweep_vectors (void)
2871 { 2884 {
2872 ptrdiff_t total_bytes; 2885 ptrdiff_t total_bytes;
2873 2886
2887 cleanup_vector (vector);
2874 nbytes = vector_nbytes (vector); 2888 nbytes = vector_nbytes (vector);
2875 total_bytes = nbytes; 2889 total_bytes = nbytes;
2876 next = ADVANCE (vector, nbytes); 2890 next = ADVANCE (vector, nbytes);
@@ -2882,6 +2896,7 @@ sweep_vectors (void)
2882 { 2896 {
2883 if (VECTOR_MARKED_P (next)) 2897 if (VECTOR_MARKED_P (next))
2884 break; 2898 break;
2899 cleanup_vector (next);
2885 nbytes = vector_nbytes (next); 2900 nbytes = vector_nbytes (next);
2886 total_bytes += nbytes; 2901 total_bytes += nbytes;
2887 next = ADVANCE (next, nbytes); 2902 next = ADVANCE (next, nbytes);