|
|
#1 |
|
Ulimit doesn't work (memory)
I've wrote sample program in C++:
#include<cstdio> #include<cstdlib> long long T[5000000]; int main(){ for(int i=0;i<5000000;i++) T[i]=rand()%5000000; for(int i=0;i<5000000;i++) T[i]=T[rand()%5000000]; printf("%lld\n",T[rand()%5000000]); return 0; } It uses memory: ~40MB But when I check it in terminal: dzwiedziu:~/test_ulimit # ulimit -v 1000 dzwiedziu:~/test_ulimit # ./test 1480040 dzwiedziu:~/test_ulimit # ulimit -H -a core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) 1000 open files (-n) unlimited pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 65532 cpu time (seconds, -t) unlimited max user processes (-u) 532 virtual memory (kbytes, -v) 1000 This program should be killed. I've worked on linux for 4 years. What's wrong? |
|
|
|
0
|
|
|
#2 |
|
Where are you getting the 40Mb figure from? If it's VSize in Activity Monitor then you're looking at it wrong...
__________________
Sponsor me to cycle 100Km round London in the dark |
|
|
|
0
|
|
|
#3 | |
|
Quote:
Seems to do exactly what the man page says, and seems that MacOS X is not a system that allows such control, or maybe it has a default that you can't go below (like 64 MB) or whatever. Feel free to file a bug report with Apple. They'll probably tell you "works as designed". |
||
|
|
0
|
|
|
#4 | |
|
Quote:
When I set limit on 1kb I've the same effect: dzwiedziu:~/test_ulimit # ulimit -v 1 dzwiedziu:~/test_ulimit # ./test 1480040 dzwiedziu:~/test_ulimit # ulimit -H -a core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) 1 open files (-n) unlimited pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 65532 cpu time (seconds, -t) unlimited max user processes (-u) 532 virtual memory (kbytes, -v) 1 |
||
|
|
0
|
|
|
#5 | |
|
Quote:
|
||
|
|
0
|
|
|
#6 | |
|
Quote:
Thx. Maybe you know, is any similary program to ulimit on Leopard, or any way to kill procces when it use to much memory. |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Can't enable iMessage, FaceTime Not Working, iphone 4, iOS 5 | tido2012 | iOS 5 and earlier | 7 | Mar 23, 2012 02:50 PM |
| Ahhh! Wifi doesn't work after computer wakes from sleep | Kauai | Mac Basics and Help | 2 | Nov 19, 2011 07:47 PM |
| Powerbook g3 internal keyboard doesn't work | In-Correct | PowerPC Macs | 2 | Aug 31, 2011 04:32 PM |
| Day Bank doesn't work after jailbreaking. Doesn't this say something? | cualexander | Jailbreaks and iOS Hacks | 2 | Jul 24, 2008 06:30 AM |
| AT&T Logo doesn't show up and phone doesn't work | DingerSox | iPhone | 1 | Aug 25, 2007 07:55 AM |
All times are GMT -5. The time now is 03:22 AM.







Linear Mode

