Help - Search - Members - Calendar
Full Version: Memory Shortage When Compiling Inside X/qt
OESF Forums > Distros, Development, and Model Specific Forums > Everything Development > X/Qt
xjqian
I tried to natively compile a GUI program in X/Qt. However, during the make process, it often popped up a window saying that memory of the workspace was too low (suggesting me to close X/Qt). Frequently X/Qt was automatically shut down due to insufficient memory. Although I did enable 256Mb swap space, it was hardly used by more than half as I monitored.


Anybody had experience with this. Is such a compiling prohibitive in nature due to Z's memory limitation?
qx773
You might have to change the "/etc/fstab" entry for "/tmp" to have it point to some other space, such as SD card, MMC card, or CF card. By default on the Sharp ROM, the "/tmp" directory is located in RAM.
pgas
some compilations (especially C++) requires a lot of memory but with a 256MB swap you should be fine in most cases.

Perhaps X/qt only monitor the physical free memory and doesn't take the swap into account?
maybe you should try to compile in a console outside of x/qt
Meanie
There is a env variable you can set, maybe TMP, cannot remember exactly, which you can use to point it at an alternate tmp location with more space. /tmp is definately not enuff.
xjqian
thanks for the advice. I didn't notice any RAM usage during compilation because I don't have /tmp set in /etc/fstab (I don't even have the fstab in the chrooted environment), maybe I should set it. And I'll try the TMP env variable in X/Qt.

The interesting part right now is that although X/Qt crashed (you can't see the x/qt screen and "your memory is very low, please reboot" warning don't have x/qt in the list anymore), "cc1ql" is still compiling in the backgroud. It's been going for 20hrs now, yes it is a big C++ GUI application I'm trying to compile just for grins.
xjqian
finally built it. but seg fault mad.gif
chyang
Originally, I would set the environment variable TMP to other directory. This works on my C3000.
xjqian
Inside the chroot env
CODE
export TMP=/tmp
export TEMP=/temp

which means TMP and TEMP should all be on my CF card. However, this does not stop the annoying memory shortage warning. The behavior is transiant. So I believe that such warning shows up whenever memory usage approachs 64MB limit (i.e.the physical RAM). It's ok if swap speed can catch up with the memory demand at the verge of overflow. Otherwise, X/Qt will crash.
PaulBx1
QUOTE
So I believe that such warning shows up whenever memory usage approachs 64MB limit (i.e.the physical RAM). It's ok if swap speed can catch up with the memory demand at the verge of overflow. Otherwise, X/Qt will crash.


I'm hardly the expert, but I wonder if you reduce the priority of the compile task very low, the system might be able to keep up? That's the "nice" command, right?

Also, do you think it matters where you keep your source and output files? Might be worth moving them around; the different I/O rates could have an effect.

Try compiling something smaller?

Still, these sound like band-aid approaches. The OS should suspend applications automatically while it is keeping the swap situation and memory allocation correct, seems to me. I'm no kernel hacker, though.
xjqian
Do you know how to use the "nice" command? I'm not an expert either. But I doubt it will help because the memory usage soars only for a short period of time while CPU usage is low. I think that's the period of linkage , right? In my case, seems lots of object files need to be loaded.

my source and output files are all on a 2GB Kingston Elite Pro CF card.

Compiling small programs are all fine. I'm looking into the configure file to tell it not to compile some impractical functionalities.

I think the problem is in the Qt enviroment not in X. So I want to drop into a console to launch X and debian. However, "startx &" didn't call the .xinitrc file. Anybody know how to launch X/Debian from a console?
Da_Blitz
It might be that the progrom has a hardcoded /tmp and as such you may need to symlink, if it is a tmpfs (ie in ram) then shouldnt it grow into your swap space or was its hardcoded limit half of the physical ram

when in doubt post your /etc/fstab as that will tell us what the maximum size is
ShiroiKuma
I'm not sure if it's the tmpfs that gets mounted at boot, but am surprised xgjian is the only one complaining about it.

It's not XQt, this is Qtopia's problem, i.e. I get it too during compiling and even when just doing it in console.

The only solution I have identified is open 10 or so progs at the same time. Then watch closely, as soon as the insufficient memory thing pops up, close some other prog.

This works...

But you have to keep closing and opening other programs, opening so that you have something to close when it pops up.

It's really stupid, and for large compilations this doesn't make sense...

If it is the tmp that gets mounted in fstab, then just changing the fstab doesn't work, because it gets mounted by /root/etc/rc.d/rc.rofilesys

So would changing the references to tmpfs in rc.rofilesys work? Putting them on a CF or so?
Meanie
does

export TMPDIR=/mnt/card/tmp

help?

i think the previous variable that was used, TMP, is the wrong one. see if TMPDIR provides more joy
ShiroiKuma
QUOTE(Meanie @ Apr 5 2006, 01:32 PM)
does

export TMPDIR=/mnt/card/tmp

help?

i think the previous variable that was used, TMP, is the wrong one. see if TMPDIR provides more joy
*

OK, I'll try this one.

I've tried TMP=/mnt/cf/.tmp
and
TEMP=/mnt/cf/.tmp

so far, both have not have had any effect.
ShiroiKuma
QUOTE(Meanie @ Apr 5 2006, 01:32 PM)
does

export TMPDIR=/mnt/card/tmp

help?
*

Confirmed... I've done
CODE
export TMPDIR=/mnt/card/.tmp
and it no longer bombs out.

Thanks for this great tip.
xjqian
CODE
export TMPDIR=/mnt/card/.tmp
and it no longer bombs out.


Where did you put that line? No matter where I put it, either before croot (i.e. .xintrc) or after croot (i.e. startd), it still bombs out.
ShiroiKuma
That doesn't work. Just run it from the command prompt before starting make or configue or whatever.
xjqian
QUOTE(ShiroiKuma @ Apr 9 2006, 08:57 AM)
That doesn't work. Just run it from the command prompt before starting make or configue or whatever.
*


Nope, that doesn't work either. (I mounted my sd card into the chroot env. Then point the TMPDIR to there as you described.)
ShiroiKuma
QUOTE(xjqian @ Apr 10 2006, 06:48 AM)
Nope, that doesn't work either. (I mounted my sd card into the chroot env. Then point the TMPDIR to there as you described.)
*

I don't understand why you're doing what you're doing?

Why are you setting TMPDIR after chroot? Why are you chrooting? Are you compiling in debian?

Anyhow, you must do this in Qtopia, i.e. run a console, and do this. Then you can mount bind the card to a chrooted location, then chroot and compile, if this is what you're doing.
xjqian
I understand this is an Qtopia problem. I works for me now after putting the following line in the .xinitrc
CODE
export TMPDIR=/mnt/card/tmp
su -c 'mount /dev/mmcda1 `cat /etc/debroot`/mnt/card'


Interesting enough, previously it didn't work for me as I mount bind the card to a chrooted location /mnt/sd instead of /mnt/card. Seems the mount points need to be coherent inside and outside chroot enviroment, which is beyond my expectation.
DoTheDog
Resurrecting an old post. I've been trying to compile a relatively large C++ package native in Pocketworkstation and I keep getting the dreaded Memory Status thing coming up. If I leave it it will crash Pocketworkstation.

I have tried:

In qtopia terminal "export TMPDIR=/mnt/card/tmp" on a 512MB sd card for both root and zaurus. Then "xlauncher debian". Still bombs out.

Also,
CODE
export TMPDIR=/mnt/card/tmp
su -c 'mount /dev/mmcda1 `cat /etc/debroot`/mnt/card'

in /home/zaurus/.xinitrc
then "xlauncher debian" and it still doesn't work.

I even tried Shiroikuma's open and close qt apps but it takes a long time to do and it eventually bombs out.

Any ideas? help? Meanie?
ShiroiKuma
QUOTE(DoTheDog @ Jul 19 2006, 05:05 PM)
In qtopia terminal "export TMPDIR=/mnt/card/tmp" on a 512MB sd card for both root and zaurus. Then "xlauncher debian". Still bombs out.
*

What does echo TMPDIR say after you chroot?

Is the card accessible under debian, have you bind mounted it?
DoTheDog
Hi Shiroikuma,
How do you bind it in chroot? when I do "echo $TMPDIR" it comes back blank in Pocketworkstation. I can see the card though.

DoTheDog

EDIT:
In qt I tried
"mount -o bind /mnt/card /hdd2/debroot/mnt/card"
and it still comes up blank in pocketworkstation.

Edit2:
Looks like the card is already mounted in debian. mount in qt gives:
/dev/mmcda1 on /usr/mnt.rom/card type vfat (rw,noatime)

So I tried export TMPDIR=/mnt/card/tmp in Pocketworkstation.
Now in chroot echo $TMPDIR, gives /mnt/card/tmp AND in qt I get the same, but I still get the Qt Memory status thing.

Help?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.