Memory leak
Alan Adams (2486) 1149 posts |
I have a program running on a rPi, which periodically (after a week or so) silently quits. At that point any attempt to do anything with the desktop produces “There is not enough memory to create this menu or window” with the error box title Pinboard. It requires a power cycle at that point. Are there any suggestions where I should be looking? |
Stuart Swales (8827) 1357 posts |
Watch the Task Manager for a memory leak |
Alan Adams (2486) 1149 posts |
I had that open on the desktop when it failed last time. The top part didn’t show any changes. I’ve now got a higher screen resolution so I can have more of it in view, as once the fault occurs I can’t scroll down it. Notably the memory allocation of Pinboard didn’t change. That might mean that the tasks display couldn’t update after the problem, but there wasn’t anything I noticed creeping upwards. Free and Next didn’t change. |
Stuart Painting (5389) 714 posts |
Doesn’t that normally indicate RMA exhaustion? Leave the Tasks window scrolled to the bottom so that you can read the “Module area” value. IIRC the maximum permitted is 256MB. |
Alan Adams (2486) 1149 posts |
That’s what I hoped someone would tell me. Currently showing 13512K after 24 hours running. JUst checked, as it’s several years since I wrote it. There’s no use of pollword-non-zero, so this isn’t allocating RMA for that purpose. It is calling IIC_Control. It’s using an IIC-to-one-wire adapter to read an array of temperature sensors. I don’t know what that SWI does internally. |
Alan Adams (2486) 1149 posts |
So now, after a day of running, the module area is over 150MB, and growing at 4K per second. How would I find out why? |
Stuart Swales (8827) 1357 posts |
Is ReportHeap from Reporter useful? Or perhaps Nemo’s !RMA https://sites.google.com/view/nemo20000/rma |
Alan Adams (2486) 1149 posts |
!RMA shows a huge number of 128 byte blocks. The first address in those all contain 2001cb94. I can’t remember how to find out where that address is. |
Martin Avison (27) 1494 posts |
I agree with Stuart, but although !RMA gives a good visual representation but does not lend itself to spotting changes.
then compare the results (eg !SideDiff) in the hope you can spot repeated changes. Check your default Reporter Save file name ends in a hash sign, so it appends a number 1-255. |
Stuart Swales (8827) 1357 posts |
That address is likely to be module related – have a gander at *Modules |
Alan Adams (2486) 1149 posts |
Did that. It isn’t in any of them.
I’ll have a look at that later, though I’m going to have to change Reporter to save to disc, rather than ram disc, since the computer locks up totally when this problem runs to completion. Incidentally !RMA downloads as an application. I did it first on Windows (where I use the forum) and it just got messy – all the filetypes were wrong, and I failed to guess all of them correctly, so it kept aborting. (!runimage was data, all the sprites were text, the help file was something odd, and the !run was a word document.) I had to use Iris to download it – tricky in itself as it kept putting https:// in front of the URL I pasted in, which also contained https://. |
Stuart Painting (5389) 714 posts |
It downloaded as a ZIP file here. One possibility is that the browser – or Windows itself – was “helpfully” unpacking the ZIP file for you (Safari on macOS has an option called “Open safe files after downloading” which does pretty much exactly what you described). |
Alan Adams (2486) 1149 posts |
I was using Firefox on Windows 10. Click on the link opens an “Extract” window, though the downloaded file is a zip. Right-click, and “save link as” allows direct saving of the Zip file. I must remember that for the future. |
Stuart Swales (8827) 1357 posts |
Firefox on Windows 11 here – downloads as a ZIP. Might have set to auto-open in Explorer? |
Alan Adams (2486) 1149 posts |
Firefox is set to “always ask where to save”. It doesn’t ask, or not in this case at least. Instead it downloads, then opens an extract folder, from which I “saved” the file, as I expected to get a “save as” window. |
Martin Avison (27) 1494 posts |
A good place to start would be !Reporter.Examples.Basic.HeapCheck – probably only needs the Clear and Save commands adding, and the interval time adjusting to suit. And maybe a limiting count to stop it after 10 or whatever. |