Skip to content

Cannot Allocate Memory when using Interrupts #21

Open
@alindsay81

Description

@alindsay81

So i created a fairly simple python program counting pulses using interrupts and i tested it on the bench with a single input for a couple of days and everything seemed to work well, when i started to use it for real i had 5 inputs and the pulse frequency was a bit higher, after around 22 hours the counting would stop. When i looked into why it could see that Python3 memory use was going up and up everytime a pulse was counted. The first thing i did was to create a test program that only counted and the problem persists with the pi eventually giving the error Cannot Allocate Memory - my test code is here;

def testcount(event):
global Count1
Count1 += 1
print(Count1)

Setup the Digital IO to watch for Rising Edge only

pifacedigital = pifacedigitalio.PiFaceDigital()

listener = pifacedigitalio.InputEventListener(chip=pifacedigital)
listener.register(0, pifacedigitalio.IODIR_RISING_EDGE, testcount)
listener.activate()

Here is a screen shot of the pi back on the bench showing the memory use rising. it only rises when a pulse is received

sc2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions