1833906 Members
1957 Online
110063 Solutions
New Discussion

Memory fault

 
Kenn Chen
Advisor

Memory fault

Currently, my user want to run a process (executable c program) but error (memory fault). Any idea why it happen ?? I can use root user to run it without problem. File system for the user is around 80 %. Could we give some memory allocation for particular user ?
Cyber Zen
3 REPLIES 3
Paula J Frazer-Campbell
Honored Contributor

Re: Memory fault

Hi
Two things come to mind -

The environmental variables for root compared to the user and the programme itself.

What memory is the programme using and also what is hapening to the users file system as it runs - also compare what happens when root runs it - it could be a premissions problem.

I tend to find the users are lax in making their programmes cpu/memory and file size efficient, I would therefore get the user to look closly at their code and improve its efficiency before making any major changes to your system.

Just a few ideas

Paula
If you can spell SysAdmin then you is one - anon
A. Clay Stephenson
Acclaimed Contributor

Re: Memory fault

This is difficult and a little more data would help. Do a ulimit -a as (I assume you are running the POSIX shell) this user and as root.
Are the data,stack, and memory ulimits different.
If you have the c source the debugger should indicate where the error is occuring and the value of errno. At the very least, can you get the exit status of the program.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: Memory fault

After thinking about this for a few minutes I at least have a theory. It is very unusual for a process to fail with a memory fault when running as a regular user but not as root. It is quite common for a program to fail with an EPERM error however. I think that this is what is really happening. Consider this scenario:
The program attempts to allocate memory or return a pointer to some structure. I think this system call or library function is failing
and setting errno to EPERM when running as a regular user. The system call (or function) returns a NULL pointer when run by a regular user but the programmer uses the value without checking for a NULL result. Using a NULL pointer (or some other improper address) results in the memory fault. This is my best guess but it does explain the observed data.
Hope this helps ... Clay.
If it ain't broke, I can fix that.