Skip to content

memory allocation failed, allocating 1024 bytes #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
robmarkcole opened this issue Nov 3, 2018 · 3 comments
Closed

memory allocation failed, allocating 1024 bytes #7

robmarkcole opened this issue Nov 3, 2018 · 3 comments

Comments

@robmarkcole
Copy link

robmarkcole commented Nov 3, 2018

Adafruit CircuitPython 3.0.3 on 2018-10-10; Adafruit Metro M0 Express with samd21g18
I get:

Traceback (most recent call last):
  File "code.py", line 7, in <module>
  File "adafruit_onewire/bus.py", line 134, in scan
MemoryError: memory allocation failed, allocating 1024 bytes

Update: same error on Adafruit CircuitPython 3.0.3 on 2018-10-10; Adafruit Trinket M0 with samd21e18

@caternuson
Copy link
Contributor

Check your hardware setup. There's no limit check on the scan, so if something weird is happening with the bus that appears to keep returning rom codes, then it will loop forever until it runs out of memory:
https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/master/adafruit_onewire/bus.py#L134

@caternuson
Copy link
Contributor

@caternuson
Copy link
Contributor

We updated the OneWire library to limit the amount of devices it will add to the list when scanning. This should prevent the memory allocation error, but you will still get an exception thrown if something is wrong with your bus causing the scan to not go nicely. If you actually have more than the max devices, you can set the number and scan again.

Try the latest library when it goes live.

Closing for now. Re-open if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants