The R Project SVN R

Rev

Rev 66751 | Rev 68643 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 66751 Rev 67181
Line 120... Line 120...
120
 
120
 
121
 
121
 
122
/* memory tracing */
122
/* memory tracing */
123
/* report when a traced object is duplicated */
123
/* report when a traced object is duplicated */
124
 
124
 
-
 
125
#ifdef R_MEMORY_PROFILING
-
 
126
 
125
SEXP attribute_hidden do_tracemem(SEXP call, SEXP op, SEXP args, SEXP rho)
127
SEXP attribute_hidden do_tracemem(SEXP call, SEXP op, SEXP args, SEXP rho)
126
{
128
{
127
#ifdef R_MEMORY_PROFILING
-
 
128
    SEXP object;
129
    SEXP object;
129
    char buffer[21];
130
    char buffer[21];
130
 
131
 
131
    checkArity(op, args);
132
    checkArity(op, args);
132
    check1arg(args, call, "x");
133
    check1arg(args, call, "x");
Line 148... Line 149...
148
		  _("'tracemem' is not useful for weak reference or external pointer objects"));
149
		  _("'tracemem' is not useful for weak reference or external pointer objects"));
149
 
150
 
150
    SET_RTRACE(object, 1);
151
    SET_RTRACE(object, 1);
151
    snprintf(buffer, 21, "<%p>", (void *) object);
152
    snprintf(buffer, 21, "<%p>", (void *) object);
152
    return mkString(buffer);
153
    return mkString(buffer);
153
#else
-
 
154
    errorcall(call, _("R was not compiled with support for memory profiling"));
-
 
155
    return R_NilValue;
-
 
156
#endif
-
 
157
}
154
}
158
 
155
 
159
 
-
 
160
SEXP attribute_hidden do_untracemem(SEXP call, SEXP op, SEXP args, SEXP rho)
156
SEXP attribute_hidden do_untracemem(SEXP call, SEXP op, SEXP args, SEXP rho)
161
{
157
{
162
#ifdef R_MEMORY_PROFILING
-
 
163
    SEXP object;
158
    SEXP object;
164
 
159
 
165
    checkArity(op, args);
160
    checkArity(op, args);
166
    check1arg(args, call, "x");
161
    check1arg(args, call, "x");
167
 
162
 
Line 171... Line 166...
171
	TYPEOF(object) == SPECIALSXP)
166
	TYPEOF(object) == SPECIALSXP)
172
	errorcall(call, _("argument must not be a function"));
167
	errorcall(call, _("argument must not be a function"));
173
 
168
 
174
    if (RTRACE(object))
169
    if (RTRACE(object))
175
	SET_RTRACE(object, 0);
170
	SET_RTRACE(object, 0);
-
 
171
    return R_NilValue;
-
 
172
}
-
 
173
 
176
#else
174
#else
-
 
175
 
-
 
176
SEXP attribute_hidden NORET do_tracemem(SEXP call, SEXP op, SEXP args, SEXP rho)
-
 
177
{
-
 
178
    errorcall(call, _("R was not compiled with support for memory profiling"));
-
 
179
}
-
 
180
 
-
 
181
SEXP attribute_hidden NORET do_untracemem(SEXP call, SEXP op, SEXP args, SEXP rho)
-
 
182
{
177
    errorcall(call, _("R was not compiled with support for memory profiling"));
183
    errorcall(call, _("R was not compiled with support for memory profiling"));
178
#endif
-
 
179
    return R_NilValue;
-
 
180
}
184
}
181
 
185
 
-
 
186
#endif /* R_MEMORY_PROFILING */
182
 
187
 
183
#ifndef R_MEMORY_PROFILING
188
#ifndef R_MEMORY_PROFILING
184
void memtrace_report(void* old, void *_new) {
189
void memtrace_report(void* old, void *_new) {
185
    return;
190
    return;
186
}
191
}