Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
ed162b5e
Commit
ed162b5e
authored
10 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
gc: Recover simple gc_realloc implementation, make easier to switch between.
parent
9fd02e18
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
py/gc.c
+11
-3
11 additions, 3 deletions
py/gc.c
with
11 additions
and
3 deletions
py/gc.c
+
11
−
3
View file @
ed162b5e
...
...
@@ -434,8 +434,14 @@ void *gc_realloc(void *ptr, machine_uint_t n_bytes) {
if (n_bytes <= n_existing) {
return ptr;
} else {
// TODO check if we can grow inplace
void *ptr2 = gc_alloc(n_bytes);
// TODO false is incorrect! Should get value from current block!
void *ptr2 = gc_alloc(n_bytes,
#if MICROPY_ENABLE_FINALISER
FTB_GET(BLOCK_FROM_PTR((machine_uint_t)ptr))
#else
false
#endif
);
if
(
ptr2
==
NULL
)
{
return
ptr2
;
}
...
...
@@ -444,7 +450,8 @@ void *gc_realloc(void *ptr, machine_uint_t n_bytes) {
return
ptr2
;
}
}
#endif
#else // Alternative gc_realloc impl
void
*
gc_realloc
(
void
*
ptr_in
,
machine_uint_t
n_bytes
)
{
if
(
gc_lock_depth
>
0
)
{
...
...
@@ -524,6 +531,7 @@ void *gc_realloc(void *ptr_in, machine_uint_t n_bytes) {
return
ptr_out
;
}
#endif // Alternative gc_realloc impl
void
gc_dump_info
()
{
gc_info_t
info
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment