Skip to content
Snippets Groups Projects
  1. Dec 20, 2018
  2. Jun 12, 2018
    • Damien George's avatar
      py/gc: Add gc_sweep_all() function to run all remaining finalisers. · 522ea80f
      Damien George authored
      This patch adds the gc_sweep_all() function which does a garbage collection
      without tracing any root pointers, so frees all the memory, and most
      importantly runs any remaining finalisers.
      
      This helps primarily for soft reset: it will close any open files, any open
      sockets, and help to get the system back to a clean state upon soft reset.
      522ea80f
  3. Jul 31, 2017
  4. Jul 18, 2017
    • Alexander Steffen's avatar
      all: Unify header guard usage. · 299bc625
      Alexander Steffen authored
      The code conventions suggest using header guards, but do not define how
      those should look like and instead point to existing files. However, not
      all existing files follow the same scheme, sometimes omitting header guards
      altogether, sometimes using non-standard names, making it easy to
      accidentally pick a "wrong" example.
      
      This commit ensures that all header files of the MicroPython project (that
      were not simply copied from somewhere else) follow the same pattern, that
      was already present in the majority of files, especially in the py folder.
      
      The rules are as follows.
      
      Naming convention:
      * start with the words MICROPY_INCLUDED
      * contain the full path to the file
      * replace special characters with _
      
      In addition, there are no empty lines before #ifndef, between #ifndef and
      one empty line before #endif. #endif is followed by a comment containing
      the name of the guard macro.
      
      py/grammar.h cannot use header guards by design, since it has to be
      included multiple times in a single C file. Several other files also do not
      need header guards as they are only used internally and guaranteed to be
      included only once:
      * MICROPY_MPHALPORT_H
      * mpconfigboard.h
      * mpconfigport.h
      * mpthreadport.h
      * pin_defs_*.h
      * qstrdefs*.h
      299bc625
  5. Jun 30, 2016
  6. Nov 29, 2015
  7. Nov 07, 2015
    • Dave Hylands's avatar
      py: Clear finalizer flag when calling gc_free. · 7f3c0d1e
      Dave Hylands authored
      Currently, the only place that clears the bit is in gc_collect.
      So if a block with a finalizer is allocated, and subsequently
      freed, and then the block is reallocated with no finalizer then
      the bit remains set.
      
      This could also be fixed by having gc_alloc clear the bit, but
      I'm pretty sure that free is called way less than alloc, so doing
      it in free is more efficient.
      7f3c0d1e
  8. Jul 14, 2015
    • Damien George's avatar
      py: Improve allocation policy of qstr data. · ade9a052
      Damien George authored
      Previous to this patch all interned strings lived in their own malloc'd
      chunk.  On average this wastes N/2 bytes per interned string, where N is
      the number-of-bytes for a quanta of the memory allocator (16 bytes on 32
      bit archs).
      
      With this patch interned strings are concatenated into the same malloc'd
      chunk when possible.  Such chunks are enlarged inplace when possible,
      and shrunk to fit when a new chunk is needed.
      
      RAM savings with this patch are highly varied, but should always show an
      improvement (unless only 3 or 4 strings are interned).  New version
      typically uses about 70% of previous memory for the qstr data, and can
      lead to savings of around 10% of total memory footprint of a running
      script.
      
      Costs about 120 bytes code size on Thumb2 archs (depends on how many
      calls to gc_realloc are made).
      ade9a052
  9. Jan 07, 2015
  10. Jan 01, 2015
  11. Oct 31, 2014
  12. Oct 24, 2014
  13. Jul 03, 2014
  14. Jul 01, 2014
  15. May 03, 2014
    • Damien George's avatar
      Add license header to (almost) all files. · 04b9147e
      Damien George authored
      Blanket wide to all .c and .h files.  Some files originating from ST are
      difficult to deal with (license wise) so it was left out of those.
      
      Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
      04b9147e
  16. Apr 08, 2014
  17. Apr 05, 2014
  18. Apr 03, 2014
  19. Feb 26, 2014
  20. Feb 11, 2014
  21. Oct 23, 2013
  22. Oct 22, 2013
  23. Oct 21, 2013
Loading