"Cannot allocate memory" error when run from script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting "Cannot allocate memory" error when run from script
# 1  
Old 01-08-2011
"Cannot allocate memory" error when run from script

hi

in my application there is a line with
open(/dev/mydevice,0);

it work good when it run manually,
but when try to run it within script
///////////////////////////////////////////
#!/bin/sh
./device_test 0 0 0 1 1 1 0 0 1
/////////////////////////////////////////
I receive 'Failed to open mydevice' "Cannot allocate memory" error

how can it be fixed
thanks in advance


linux2.6.32.2 on ARM embedded board

---------- Post updated 01-08-11 at 02:18 AM ---------- Previous update was 01-07-11 at 11:50 PM ----------

also, this problem exist when I try to run the proposed application from within Qt application using QProcess or directly use open(/dev/mydevice,0); function
# 2  
Old 01-08-2011
I would believe the error message until proved otherwise. Therefore your system needs more memory to run your script. It might be enough to make more virtual memory available, i. e. more swap area. But I get the feeling that you are short of physical memory. I don't know how easy it will be for you upgrade memory on your embedded board.
# 3  
Old 01-08-2011
thanks for your post

it is a s3c2440 ARM board equipped with
Qtopia2.2 + QtEmbedded4.6.3 + Linix2.6.32.2 + arm-linux-gcc-4.4.3(EABI)

chmod -R 777 /dev , some times, randomly solve the problem (with 6 times try to opening!)

'Qtopia System Info' shows that still there is free 44MB RAM + 13MB flash
are these free memories enough good to do script job?

---------- Post updated at 04:22 PM ---------- Previous update was at 02:30 PM ----------

the system was cleaned-up, and now it has 27MB free flash memory

but still there is the proposed error.

also, this is debug info:

/////////////////////
qt-gui: page allocation failure. order:10, mode:0xd1
Backtrace:
[<c00341cc>] (dump_backtrace+0x0/0x10c) from [<c03297d0>] (dump_stack+0x18/0x1c)
r7:00000000 r6:c04a4ca4 r5:c047f3a4 r4:00000000
[<c03297b8>] (dump_stack+0x0/0x1c) from [<c0079f4c>] (__alloc_pages_nodemask+0x540/0x5a8)
[<c0079a0c>] (__alloc_pages_nodemask+0x0/0x5a8) from [<c0079fcc>] (__get_free_pages+0x18/0x44)
[<c0079fb4>] (__get_free_pages+0x0/0x44) from [<c0269b10>] (camif_open+0x138/0x274)
[<c02699d8>] (camif_open+0x0/0x274) from [<c016bd64>] (misc_open+0x158/0x208)
[<c016bc0c>] (misc_open+0x0/0x208) from [<c009dcf4>] (chrdev_open+0xd0/0x160)
r9:00000001 r8:c009dc24 r7:00000000 r6:c3831e80 r5:c3b7fc00
r4:c347a990
[<c009dc24>] (chrdev_open+0x0/0x160) from [<c0099374>] (__dentry_open+0xd4/0x26c)
r7:c393b380 r6:c3479700 r5:c347a990 r4:c3b7fc00
[<c00992a0>] (__dentry_open+0x0/0x26c) from [<c0099604>] (nameidata_to_filp+0x60/0x68)
[<c00995a4>] (nameidata_to_filp+0x0/0x68) from [<c00a6860>] (do_filp_open+0x54c/0x878)
r5:00000024 r4:00000001
[<c00a6314>] (do_filp_open+0x0/0x878) from [<c00991c8>] (do_sys_open+0x64/0xe0)
[<c0099164>] (do_sys_open+0x0/0xe0) from [<c009927c>] (sys_open+0x24/0x28)
r8:c0030088 r7:00000005 r6:4107c000 r5:000c76c0 r4:4105d000
[<c0099258>] (sys_open+0x0/0x28) from [<c002fee0>] (ret_fast_syscall+0x0/0x28)
Mem-info:
Normal per-cpu:
CPU 0: hi: 18, btch: 3 usd: 0
active_anon:1030 inactive_anon:1149 isolated_anon:0
active_file:147 inactive_file:1920 isolated_file:0
unevictable:20 dirty:0 writeback:0 unstable:0
free:6705 slab_reclaimable:164 slab_unreclaimable:384
mapped:415 shmem:92 pagetables:87 bounce:0
Normal free:26820kB min:1016kB low:1268kB high:1524kB active_anon:4120kB inactive_anon:4596kB active_file:588kB inactive_file:7680kB unevictable:80kB isolated(anon):0kB isolated(file):0kB present:65024kB mlocked:0kB dirty:0kB writeback:0kB mapped:1660kB shmem:368kB slab_reclaimable:656kB slab_unreclaimable:1536kB kernel_stack:280kB pagetables:348kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0
Normal: 33*4kB 20*8kB 22*16kB 22*32kB 68*64kB 41*128kB 22*256kB 6*512kB 3*1024kB 2*2048kB 0*4096kB = 26820kB
2179 total pagecache pages
16384 pages of RAM
9857 free pages
1411 reserved pages
399 slab pages
473 pages shared
0 pages swap cached

---------- Post updated at 04:31 PM ---------- Previous update was at 04:22 PM ----------

==========================
by the way, this is free memory info after start-up of the board:

total used free shared buffers
Mem: 60308 23340 36968 0 0
Swap: 0 0 0
Total: 60308 23340 36968

it seems that the machine has no swap memory!

---------- Post updated at 04:38 PM ---------- Previous update was at 04:31 PM ----------

the board has sdcard interface
if a swap file will be defined on sdcard, will be solved the problem?
# 4  
Old 01-08-2011
I don't know what to think of that "chmod" remedy you have. My guess is
that it just wastes time until some memory happens to get free. That would
explain why it sometimes takes 6 tries. My workstation:
Code:
$ free
total used free shared buffers cached
Mem: 2057636 2034332 23304 0 178556 506608
-/+ buffers/cache: 1349168 708468
Swap: 4192956 148 4192808
$

It still seems to me that you need more memory. I'm not super surprised that an embedded system would have no swap. That means that physical is all you have. And you need more of it to do what you want. My guess is that the flash memory is where your files reside. More filesystem space won't help your memory problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

3. UNIX for Dummies Questions & Answers

Using SSH to run a "BASH" script.

Experts, Hello ! Im running into something that I cant seem to find an answer to. I have a script and it does the following set of actions - 1. Cd to one specific directory 2. Look for all the files that contain a string and once a occurence of the string is found, 3. Pipe that output to... (8 Replies)
Discussion started by: OMLEELA
8 Replies

4. Shell Programming and Scripting

Is this "Out of Memory!" error due to sort() of perl how to resolve it?

I am running a program written in perl script and it is stopped with "Out of memory!" error. This is very strange because at the time then the program is aborted, it only used 4GB RAM and there are still 30GB free physical memory left in the system. I check the perl script and found the program... (3 Replies)
Discussion started by: lilili07
3 Replies

5. Shell Programming and Scripting

Can run a ".sh" script as the user but not from the crontab

Hello Everyone, I am logged in as me. I created a script in the directory "/install/new" called "script1.sh" which basically runs another script "runapp.sh" . The "runapp.sh" is a vendor provided application strart up script that came with the installation. This is also in the same directory as... (10 Replies)
Discussion started by: bhaire
10 Replies

6. AIX

"too big" and "not enough memory" errors in shell script

Hi, This is odd, however here goes. There are several shell scripts that run in our production environment AIX 595 LPAR m/c, which has sufficient memory 14GB (physical memory) and horsepower 5CPUs. However from time to time we get the following errors in these shell scripts. The time when these... (11 Replies)
Discussion started by: jerardfjay
11 Replies

7. Shell Programming and Scripting

Startup Script "run process with Timer"

Hi I have a script that execute every X minute for checking new files in a folder and converting to pdf. Is there any way to start this script automatically on linux startup?. I use sleep function in script with infinite loop. while do killall -u `whoami` -q soffice soffice... (0 Replies)
Discussion started by: zawmn83
0 Replies

8. Shell Programming and Scripting

catalina.sh : need combination from "start" and "run"

heya, can someone help me with following problem. i am not sure how far you know the catalina.sh script from tomcat. when i start my tomcat with "catalina.sh run" then the startup-process-output will be printed out on the console, but the tomcat process is started in current shell/session, so... (1 Reply)
Discussion started by: Filly
1 Replies

9. Shell Programming and Scripting

How to make a script run for a maximum of "x" number of hours only

How to make a script run for a maximum of "x" number of hours only (7 Replies)
Discussion started by: ScriptDummy
7 Replies

10. UNIX for Dummies Questions & Answers

Run away "bootpgw" & "inetd"

Hello All. I'm get the following messages posted to the /var/adm/syslog file ever second and not sure on how to stop the process. May 14 15:50:52 a3360 bootpgw: version 2.3.5 May 14 15:50:52 a3360 inetd: /etc/bootpgw exit 0x1 As said about this gets logged every second only thing that... (4 Replies)
Discussion started by: cfaiman
4 Replies
Login or Register to Ask a Question