Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
cdd2c62e
Commit
cdd2c62e
authored
Jan 30, 2014
by
Paul Sokolovsky
Browse files
realloc(): Log original memory ptr too.
To alloc complete memory alloc flow tracing.
parent
4a74d31e
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/malloc.c
View file @
cdd2c62e
...
...
@@ -59,8 +59,8 @@ void *m_realloc(void *ptr, int old_num_bytes, int new_num_bytes) {
free
(
ptr
);
return
NULL
;
}
ptr
=
realloc
(
ptr
,
new_num_bytes
);
if
(
ptr
==
NULL
)
{
void
*
new_
ptr
=
realloc
(
ptr
,
new_num_bytes
);
if
(
new_
ptr
==
NULL
)
{
printf
(
"could not allocate memory, reallocating %d bytes
\n
"
,
new_num_bytes
);
return
NULL
;
}
...
...
@@ -75,8 +75,8 @@ void *m_realloc(void *ptr, int old_num_bytes, int new_num_bytes) {
current_bytes_allocated
+=
diff
;
UPDATE_PEAK
();
#endif
DEBUG_printf
(
"realloc %d, %d : %p
\n
"
,
old_num_bytes
,
new_num_bytes
,
ptr
);
return
ptr
;
DEBUG_printf
(
"realloc
%p,
%d, %d : %p
\n
"
,
ptr
,
old_num_bytes
,
new_num_bytes
,
new_
ptr
);
return
new_
ptr
;
}
void
m_free
(
void
*
ptr
,
int
num_bytes
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment