[前][次][番号順一覧][スレッド一覧]

ruby-changes:28901

From: ko1 <ko1@a...>
Date: Mon, 27 May 2013 16:17:41 +0900 (JST)
Subject: [ruby-changes:28901] ko1:r40953 (trunk): * vm_trace.c (rb_postponed_job_flush, rb_postponed_job_register): use

ko1	2013-05-27 16:17:30 +0900 (Mon, 27 May 2013)

  New Revision: 40953

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40953

  Log:
    * vm_trace.c (rb_postponed_job_flush, rb_postponed_job_register): use
      ruby_xmalloc/xfree. It is safe during GC.

  Modified files:
    trunk/ChangeLog
    trunk/vm_trace.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40952)
+++ ChangeLog	(revision 40953)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon May 27 16:16:18 2013  Koichi Sasada  <ko1@a...>
+
+	* vm_trace.c (rb_postponed_job_flush, rb_postponed_job_register): use
+	  ruby_xmalloc/xfree. It is safe during GC.
+
 Mon May 27 09:24:03 2013  Koichi Sasada  <ko1@a...>
 
 	* test/-ext-/postponed_job/test_postponed_job.rb: fix typo and class name.
Index: vm_trace.c
===================================================================
--- vm_trace.c	(revision 40952)
+++ vm_trace.c	(revision 40953)
@@ -1390,7 +1390,7 @@ rb_postponed_job_register(unsigned int f https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1390
 {
     rb_thread_t *th = GET_THREAD();
     rb_vm_t *vm = th->vm;
-    rb_postponed_job_t *pjob = (rb_postponed_job_t *)malloc(sizeof(rb_postponed_job_t)); /* postponed_job should be separated with Ruby's GC */
+    rb_postponed_job_t *pjob = (rb_postponed_job_t *)ruby_xmalloc(sizeof(rb_postponed_job_t));
     if (pjob == NULL) return 0; /* failed */
 
     pjob->flags = flags;
@@ -1429,7 +1429,7 @@ rb_postponed_job_flush(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1429
     while (pjob) {
 	next_pjob = pjob->next;
 	pjob->func(pjob->data);
-	free(pjob); /* postponed_job should be separated with Ruby's GC */
+	ruby_xfree(pjob); /* postponed_job should be separated with Ruby's GC */
 	pjob = next_pjob;
     }
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]