Search found 11 matches

by sameid
Wed Jun 28, 2017 5:33 am
Forum: Development of MicroPython
Topic: Debugging a memory problem
Replies: 9
Views: 7906

Re: Debugging a memory problem

From what I understand in your description here the GC is doing the correct thing and retaining all the objects because they are all reachable from some root pointer. In particular, the first object is reachable because you need it. The next one is reachable because the first object points to it, a...
by sameid
Tue Jun 27, 2017 9:07 pm
Forum: Development of MicroPython
Topic: Debugging a memory problem
Replies: 9
Views: 7906

Re: Debugging a memory problem

Defining #define MICROPY_STACKLESS (1) Solves the problem, still don't know what the problem is though. Still, I can't say what the problem is... As I said before - the problem is that somewhere in the call to mp_execute_bytecode , the stack contains a pointer to the heap. I know the stack part is d...
by sameid
Wed Jun 14, 2017 5:26 pm
Forum: Development of MicroPython
Topic: Debugging a memory problem
Replies: 9
Views: 7906

Re: Debugging a memory problem

I think your answer is not cool. (Regarding https://forum.micropython.org/viewtopic.php?t=3083#p19691) There are many ways implementing a garbage collector. Mark and sweep, pointer references, etc. And even in mark and sweep there are many possible different implementations. What I obviously meant b...
by sameid
Sat Apr 08, 2017 9:47 am
Forum: Development of MicroPython
Topic: Debugging a memory problem
Replies: 9
Views: 7906

Re: Debugging a memory problem

Dave, It's hard for me to understand how come it's a dangling pointer issue - because when I do add some gc.collect code in specific places - I don't experience any leaks - meaning no dangling pointers at the moment I call gc.collect. If it is a stack issue I will not be able to find the cause by pr...
by sameid
Fri Apr 07, 2017 8:32 pm
Forum: Development of MicroPython
Topic: redundant memset?
Replies: 2
Views: 2530

Re: redundant memset?

I suspect its history of how the code has evolved. I'm pretty sure that gc_alloc didn't used to do a memset, and it was added because there were certain cases where it would cause memory to not be freed it that wasn't being done. Allocating a bytearray needs to guarantee that the contents are zero'...
by sameid
Fri Apr 07, 2017 8:24 pm
Forum: Development of MicroPython
Topic: Debugging a memory problem
Replies: 9
Views: 7906

Debugging a memory problem

I have a "memory leak" - why do I chose to call it a memory problem and not a memory leak in the title? Because I am not convinced of it yet... I am running Micropython on Windows with varying sizes of GC heap. My application implements an echo server using socket code (C and Py code) that I wrote m...
by sameid
Wed Apr 05, 2017 7:40 pm
Forum: Development of MicroPython
Topic: redundant memset?
Replies: 2
Views: 2530

redundant memset?

Hey I would like to understand why we call memset at: https://github.com/micropython/micropython/blob/94c41bb06f6482ece0717c5bd63266b8da063caa/py/objarray.c#L189 I thought the GC in both modes: (MICROPY_GC_CONSERVATIVE_CLEAR/0) https://github.com/micropython/micropython/blob/94c41bb06f6482ece0717c5b...
by sameid
Tue Feb 28, 2017 3:43 pm
Forum: Development of MicroPython
Topic: Memory allocation and deallocation
Replies: 21
Views: 17223

Re: Memory allocation and deallocation

I see,

It's a shame that there is no clear/thouroughful documentation regarding this matter - feels like it's one of the basics in case one wants to contribute.

In any case, big thanks for the explanations!

Sam
by sameid
Tue Feb 28, 2017 7:50 am
Forum: Development of MicroPython
Topic: Memory allocation and deallocation
Replies: 21
Views: 17223

Re: Memory allocation and deallocation

Interesting, so let's see if I got it right: 1. If the heap contains a pointer to the heap - the GC will treat it as a referenced memory. (It must be aligned?) 2. The GC has to scan all bytes in the heap to clean internally referenced memory 3. If, god forbid, my internal pointer will not be aligned...
by sameid
Tue Feb 28, 2017 6:46 am
Forum: Development of MicroPython
Topic: Memory allocation and deallocation
Replies: 21
Views: 17223

Re: Memory allocation and deallocation

Thanks for the explanation, but I still haven't gotten my answer. If I return my own object, from a type I created using m_new on 10 bytes from a c function to the vm. But in my own object the first 4 bytes (32 bit machine) is an internal pointer in the struct that points to another memory, let's sa...