2009-06-10 07:17:15 memory allocation
Nikolay Chokoev (IRELAND)
Message: 75454
Hi,
I'm runing application and exiting with memory allocation error. I try to learn more about why this happened, as the application is about 9MB and should have 20MB+ free RAM.
What does it means:
DMA: 20*4kB 19*8kB 16*16kB 12*32kB 4*64kB 9*128kB 4*256kB 1*512kB 0*1024kB 1*204
8kB 1*4096kB 2*8192kB 0*16384kB 0*32768kB = 26344kB
Does it mean that if I'm trying to load 9MB file, for example, it will fail with memory allocation error, even I have 25MB free? Do I have 25MB free? If so how can I do that?
Is there any document describing more about this?
Regards,
Nikolay
QuoteReplyEditDelete
2009-06-10 09:59:44 Re: memory allocation
Robin Getz (UNITED STATES)
Message: 75461
Nikolay:
You have 25Meg total - but not 25Meg continuous. You have 2 pages 8Meg in length - so that is the biggest application you can run.
See:
https://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:difference_from_linux#virtual_memory
And look at the fragementation section.
-Robin
QuoteReplyEditDelete
2009-06-10 10:08:36 Re: memory allocation
Nikolay Chokoev (IRELAND)
Message: 75463
Can I do something?
Can I allocate one 16MB instead 2 of 8MB?
QuoteReplyEditDelete
2009-06-10 10:42:03 Re: memory allocation
Robin Getz (UNITED STATES)
Message: 75464
You booted the system - that will cause fragementation.
Add more memory to your system.
-Robin
QuoteReplyEditDelete
2009-06-10 11:15:12 Re: memory allocation
Frank Van Hooft (CANADA)
Message: 75468
You might have been able to allocate a 16 MB chunk when the system first booted. But as your printout shows, and Robin stated, now your biggest available chunk is 8 MB. At that point, doing a malloc() for anything greater than 8MB will cause a failure.
Do you really need to keep malloc'ing and free'ing memory? Can you just malloc a big chunk of memory when your app first runs, and then keep it?
QuoteReplyEditDelete
2009-06-10 12:06:59 Re: memory allocation
Nikolay Chokoev (IRELAND)
Message: 75470
Actually I try to run a large executable file (> 8MB) and that fails.
Is it possible to 'reserve' a 16 MB chunk at boot time (with bootargs mem=16M max_mem=32M$#) and after the kernel is booted to tell'im that I have 16MB extra memory and to allocate them as a chunk?
... or any other trick...?
QuoteReplyEditDelete
2009-06-10 14:29:23 Re: memory allocation
Robin Getz (UNITED STATES)
Message: 75475
Nikolay:
No - there is no workaround - add more memory - or don't use Qt. It is known to be a hog.
-Robin
QuoteReplyEditDelete
2009-06-10 14:29:25 Re: memory allocation
Mike Frysinger (UNITED STATES)
Message: 75476
no, that takes memory away from linux completely -- nothing can execute in it
QuoteReplyEditDelete
2009-06-13 14:55:25 Re: memory allocation
Nikolay Chokoev (IRELAND)
Message: 75645
How can I get the memory allocation information like:
DMA: 20*4kB 19*8kB 16*16kB 12*32kB 4*64kB 9*128kB 4*256kB 1*512kB 0*1024kB 1*204
8kB 1*4096kB 2*8192kB 0*16384kB 0*32768kB = 26344kB
from the console? Any command?
QuoteReplyEditDelete
2009-06-13 20:34:27 Re: memory allocation
Mike Frysinger (UNITED STATES)
Message: 75647
use /proc/buddyinfo, or read the proc(5) man page