Python micropython.mem_info() Examples

The following are 3 code examples of micropython.mem_info(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module micropython , or try the search function .
Example #1
Source File: __main__.py    From uPyPortal with Apache License 2.0 6 votes vote down vote up
def main(**params):
    gc.collect()
    import logging
    logging.basicConfig(level=logging.INFO)

    # Preload templates to avoid memory fragmentation issues
    gc.collect()
    app._load_template('homepage.html')
    app._load_template('admin.html')
    app._load_template('login.html')
    gc.collect()

    import micropython
    micropython.mem_info()

    gc.collect()
    # starting dns server
    dns_server = DNSServer(**params)
    dns_server.start()
    gc.collect()

    # webserver
    app.run(debug=True, **params) 
Example #2
Source File: cmd.py    From esp8266 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def mem(level=None):
    import gc
    mem_alloc = gc.mem_alloc()
    mem_free = gc.mem_free()
    capacity = mem_alloc + mem_free
    print("    capacity\tfree\tusage")
    print("    {}\t{}\t{}%".format(capacity, mem_free, int(
        ((capacity - mem_free) / capacity) * 100.0)))
    if level:
        import micropython
        micropython.mem_info(level) 
Example #3
Source File: ush.py    From esp8266 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def handle_command(self, args):
        import gc
        mem_alloc = gc.mem_alloc()
        mem_free = gc.mem_free()
        capacity = mem_alloc + mem_free
        print("    capacity\tfree\tusage")
        print("    {}\t{}\t{}%".format(capacity, mem_free, int(
            ((capacity - mem_free) / capacity) * 100.0)))
        if "-i" in args:
            import micropython
            micropython.mem_info(1)