OESF Portables Forum

Everything Else => Zaurus - Everything Development => Distros, Development, and Model Specific Forums => Archived Forums => X/Qt => Topic started by: xjqian on March 08, 2006, 04:45:40 am

Title: Memory Shortage When Compiling Inside X/qt
Post by: xjqian on March 08, 2006, 04:45:40 am
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?
Title: Memory Shortage When Compiling Inside X/qt
Post by: qx773 on March 08, 2006, 08:09:07 am
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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: pgas on March 08, 2006, 11:10:41 am
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
Title: Memory Shortage When Compiling Inside X/qt
Post by: Meanie on March 08, 2006, 11:15:10 pm
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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: xjqian on March 09, 2006, 11:03:30 am
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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: xjqian on March 14, 2006, 01:43:02 am
finally built it. but seg fault
Title: Memory Shortage When Compiling Inside X/qt
Post by: chyang on March 14, 2006, 03:13:50 am
Originally, I would set the environment variable TMP to other directory. This works on my C3000.
Title: Memory Shortage When Compiling Inside X/qt
Post by: xjqian on March 27, 2006, 04:41:44 am
Inside the chroot env
Code: [Select]
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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: PaulBx1 on March 31, 2006, 10:09:02 am
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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: xjqian on April 01, 2006, 08:10:40 pm
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?
Title: Memory Shortage When Compiling Inside X/qt
Post by: Da_Blitz on April 02, 2006, 08:45:40 am
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
Title: Memory Shortage When Compiling Inside X/qt
Post by: ShiroiKuma on April 05, 2006, 06:48:17 am
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?
Title: Memory Shortage When Compiling Inside X/qt
Post by: Meanie on April 05, 2006, 08:32:47 am
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
Title: Memory Shortage When Compiling Inside X/qt
Post by: ShiroiKuma on April 05, 2006, 08:50:27 am
Quote
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
[div align=\"right\"][a href=\"index.php?act=findpost&pid=121892\"][{POST_SNAPBACK}][/a][/div]
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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: ShiroiKuma on April 09, 2006, 02:40:42 am
Quote
does

export TMPDIR=/mnt/card/tmp

help?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=121892\"][{POST_SNAPBACK}][/a][/div]
Confirmed... I've done
Code: [Select]
export TMPDIR=/mnt/card/.tmpand it no longer bombs out.

Thanks for this great tip.
Title: Memory Shortage When Compiling Inside X/qt
Post by: xjqian on April 09, 2006, 07:39:06 am
Code: [Select]
export TMPDIR=/mnt/card/.tmpand 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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: ShiroiKuma on April 09, 2006, 09:57:01 am
That doesn't work. Just run it from the command prompt before starting make or configue or whatever.
Title: Memory Shortage When Compiling Inside X/qt
Post by: xjqian on April 10, 2006, 01:48:12 am
Quote
That doesn't work. Just run it from the command prompt before starting make or configue or whatever.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=122390\"][{POST_SNAPBACK}][/a][/div]

Nope, that doesn't work either. (I mounted my sd card into the chroot env. Then point the TMPDIR to there as you described.)
Title: Memory Shortage When Compiling Inside X/qt
Post by: ShiroiKuma on April 10, 2006, 02:37:51 am
Quote
Nope, that doesn't work either. (I mounted my sd card into the chroot env. Then point the TMPDIR to there as you described.)
[div align=\"right\"][a href=\"index.php?act=findpost&pid=122460\"][{POST_SNAPBACK}][/a][/div]
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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: xjqian on April 10, 2006, 10:11:41 am
I understand this is an Qtopia problem. I works for me now after putting the following line in the .xinitrc
Code: [Select]
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.
Title: Memory Shortage When Compiling Inside X/qt
Post by: DoTheDog on July 19, 2006, 12:05:28 pm
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: [Select]
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?
Title: Memory Shortage When Compiling Inside X/qt
Post by: ShiroiKuma on July 20, 2006, 06:49:45 am
Quote
In qtopia terminal "export TMPDIR=/mnt/card/tmp" on a 512MB sd card for both root and zaurus. Then "xlauncher debian". Still bombs out.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=135768\"][{POST_SNAPBACK}][/a][/div]
What does echo TMPDIR say after you chroot?

Is the card accessible under debian, have you bind mounted it?
Title: Memory Shortage When Compiling Inside X/qt
Post by: DoTheDog on July 20, 2006, 08:20:10 am
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?