1. Fatal memory error

Since replacing my HDD's with SSD's I tend to leave my computer running without restarting for days at a time. The program that I am working on opens and reads in three files, each 6MB in size. I have usually exited the program through a programed "abort(0)" procedure, but there have been times when I used Ctrl Z because i did not want the program to proceed with what it was doing. Today I got:

"Fatal runtime error: Your program has run out of memory. One moment please"

After a very long pause, control was returned, but everything behaved extremely sluggishly. I conclude that files were left open, with large buffers still assigned. I have three questions:

1. Does abort(0) close all open files, returning buffer space to available memory?
2. Does Ctrl Z do likewise?
3. Does restarting the system take care of loose ends?

new topic     » topic index » view message » categorize

2. Re: Fatal memory error

Hi

There's a memory leak somewhere, whether that's in the interpreter, the program you wrote, any dlls you are using or indeed windows itself. It may be impossible to find with a runtime of days.

I have something similar, a Phix slideshow program, running at my surgeries for client info and such, updated as required by dropbox. If I leave it running for several days, it invariably runs out of memory. I tried hunting it down, but to no avail. Closing and restarting helped, but there was always a gradual run out of memory

My solution was to set a time within the program to close the program down at a specific time, and then set a scheduled task to reboot the computer after this, and then in startup to restart the program. When I am in bed, or not at the surgeries, this requires no intervention from me at all now, the program runs for no more than 12 hours, and the computer reboots every 24 hours.

This solution may not suit all people where a program needs to run all the time, but even there, an occasional auto restart is often not difficult to fit in.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

3. Re: Fatal memory error

Wow! I thought it was just my novice ignorance. I am still interested in the answers to my three questions regarding closing files.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Fatal memory error

ctl-z does NOT end your program! It puts it into the background, still running, with files open.

Otherwise: Euphoria is supposed to automatically close open files, but it can't hurt to be sure. I'd start by actually calling close() on the files prior to the abort().

Secondly, you're still using Linux, right? I would open System Monitor and note the memory (and cpu) usage. Let your program load the files and just idle. Once the files are loaded into memory, the memory usage should remain stable, not creep up slowly over time. When the program closes, usage should drop back to pre-run values. If it doesn't, then you can determine where the excess usage is occurring.

If you're using ctl-z to put the program into the background, the System Monitor will show several instances of eui running. Obviously, that will eat up memory.

If the usage creeps up while the program is idle, then you're doing something in a loop that eats memory. By adding

with profile

to the top of your program, you'll get a list showing how many times each line of code is called. Look for one that stands out with thousands of calls.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Fatal memory error

Sorry, forgot that you were using Linux. If you want a console monitor, open a console, and type top - will give you a running systems usage.

Unfortunately there are many ways of starting a program at bootup in Linux, depending on where within the startup sequence you are wanting it to start, with also quite a bit of variation between actual distributions that you - I've just come across systemctl on Arch, and that's a learning experience.

Good luck

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

6. Re: Fatal memory error

irv said...

ctl-z does NOT end your program! It puts it into the background, still running, with files open.

Ctrl+Z suspends a program.

  • bg will move it to the background, as if you ran command &
  • fg will bring it back to the foreground

https://www.thegeekstuff.com/2010/05/unix-background-job/

Ctrl+C should end the program.

https://www.ostechnix.com/list-useful-bash-keyboard-shortcuts/

-Greg

new topic     » goto parent     » topic index » view message » categorize

7. Re: Fatal memory error

You are correct. Ctl-z suspends a program.

It prints the message: Stopped eui xxx which could lead someone not familiar with Linux to assume the program had been closed, and they could run it again.

They're actually still there in memory, with all files open. That may have been why the OP was running out of memory.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu