Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

help me,save my memory

Altera_Forum
Honored Contributor II
2,594 Views

hi! 

my application use more memory in the nios than arm platform 

I use the objdump print as follow: 

[root@localhost pppd]# nios2-elf-objdump --header pppd_dump.elf 

 

pppd_dump.elf: file format elf32-littlenios2 

 

Sections: 

Idx Name Size VMA LMA File off Algn 

0 .text 00023bf0 00000000 00000000 00000034 2**2 

CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 

1 .data 000071c8 00023bf0 00023bf0 00023c24 2**2 

CONTENTS, ALLOC, LOAD, RELOC, DATA, SMALL_DATA 

2 .bss 0001bf54 0002adb8 0002adb8 0002adec 2**2 

ALLOC 

3 .comment 00000630 00000000 00000000 0002adec 2**0 

CONTENTS, READONLY 

4 .debug_aranges 00000460 00000000 00000000 0002b41c 2**0 

CONTENTS, RELOC, READONLY, DEBUGGING 

5 .debug_pubnames 000014bb 00000000 00000000 0002b87c 2**0 

CONTENTS, RELOC, READONLY, DEBUGGING 

6 .debug_info 00012a78 00000000 00000000 0002cd37 2**0 

CONTENTS, RELOC, READONLY, DEBUGGING 

7 .debug_abbrev 00003af3 00000000 00000000 0003f7af 2**0 

CONTENTS, READONLY, DEBUGGING 

8 .debug_line 00013bc5 00000000 00000000 000432a2 2**0 

CONTENTS, RELOC, READONLY, DEBUGGING 

9 .debug_frame 00002150 00000000 00000000 00056e68 2**2 

CONTENTS, RELOC, READONLY, DEBUGGING 

10 .debug_str 00009385 00000000 00000000 00058fb8 2**0 

CONTENTS, READONLY, DEBUGGING 

11 .debug_ranges 00000998 00009385 00009385 0006233d 2**0 

CONTENTS, READONLY, DEBUGGING 

 

[root@localhost pppd]# arm-elf-objdump --header pppd.gdb 

 

pppd.gdb: file format elf32-littlearm 

 

Sections: 

Idx Name Size VMA LMA File off Algn 

0 .text 00024c20 00000000 00000000 00008000 2**4 

CONTENTS, ALLOC, LOAD, READONLY, CODE 

1 .data 00006bc0 00024c20 00024c20 0002cc20 2**4 

CONTENTS, ALLOC, LOAD, DATA 

2 .bss 0000a1c0 0002b7e0 0002b7e0 000337e0 2**4 

ALLOC 

3 .debug_abbrev 00014bc3 00000000 00000000 000337e0 2**0 

CONTENTS, READONLY, DEBUGGING 

4 .debug_info 002985c5 00000000 00000000 000483a3 2**0 

CONTENTS, READONLY, DEBUGGING 

5 .debug_line 0005f85c 00000000 00000000 002e0968 2**0 

CONTENTS, READONLY, DEBUGGING 

6 .debug_pubnames 0000373a 00000000 00000000 003401c4 2**0 

CONTENTS, READONLY, DEBUGGING 

7 .debug_aranges 00001c80 00000000 00000000 003438fe 2**0 

CONTENTS, READONLY, DEBUGGING 

 

Thank you for all response!
0 Kudos
16 Replies
Altera_Forum
Honored Contributor II
1,291 Views

Is it possible that applications in Linux 2.6 need more memory than those did in Linux 2.4? Could someone figue out in detail?

0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

Please try the build tools as in the thread and compare the result, 

http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174

 

Sorry, I didn't have better idea.
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

Hi Hippo, 

 

We do use the nios2 cross compiler tools according to your buildroot POST. 

But the size of the applications(pppd) code and its size in SDRAM all more bigger than arm+ linux2.4.x. 

 

Could your give your applications(pppd) parameters? Such as using cat pid/status and objdump .
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

Hi smalllight, 

 

> 2 .bss 0001bf54 0002adb8 0002adb8 0002adec 2**2 

> 2 .bss 0000a1c0 0002b7e0 0002b7e0 000337e0 2**4 

 

Your uninitialized data for Nios-II is more than twice the size for ARM. 

Everything else is reasonable. You need to compare your linker maps to 

isolate the culprit -- otherwise, it's just speculation. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

 

--- Quote Start ---  

originally posted by mountain8848@Mar 29 2006, 05:22 PM 

hi hippo, 

 

we do use the nios2 cross compiler tools according to your buildroot post. 

but the size of the applications(pppd) code and its size in sdram all more bigger than arm+ linux2.4.x. 

 

could your give your applications(pppd) parameters? such as using cat pid/status and objdump . 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=13893) 

--- quote end ---  

 

--- Quote End ---  

 

 

The code size of nios2 may be a little bigger than arm. But smalllight&#39;s problem is that it take many times of that of arm when in sdram. He said all appliactions has this problem. Sound like memory leakage. 

I didn&#39;t use arm linux, so I don&#39;t know the differences. 

 

I didn&#39;t build pppd, but I checked boa, and it seem OK. 

 

What is your memory profile before and after loading an apps? with "cat /proc/meminfo" or "free" . We also check with "cat /proc/<apps pid>/status" .
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

I didn&#39;t have better idea. 

would you try out boa? 

what is the free mem before and after "boa &" ?
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

Hi,hippo! 

I build the boa in the arm platform,the message boa process is as follow:# cat status 

Name: boa 

State: S (sleeping) 

Tgid: 60 

Pid: 60 

PPid: 56 

TracerPid: 0 

Uid: 0 0 0 0 

Gid: 0 0 0 0 

FDSize: 32 

Groups: 

Mem: 157792 bytes 

Slack: 2876 bytes 

Shared: 0 bytes 

SigPnd: 0000000000000000 

SigBlk: 0000000000000000 

SigIgn: 0000000000001a00 

SigCgt: 0000000000016443 

CapInh: 0000000000000000 

CapPrm: 00000000fffffeff 

CapEff: 00000000fffffeff 

 

can you show the boa process status in your nios platform?
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

Who can tell me what the "slack" is? what does it mean? 

 

Best Regards, 

 

Fei Wu
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

 

--- Quote Start ---  

originally posted by feiwu@Apr 10 2006, 07:16 PM 

who can  tell me what the "slack" is? what does it mean? 

 

best regards, 

 

fei wu 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14190) 

--- quote end ---  

 

--- Quote End ---  

 

slack is the wasted space in memory management. 

eg, if you want 6K, but kernel give you 8K, then 2K is wasted.
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

I think the same as what you said!  

Thank you very much! 

Best Regards, 

Fei Wu
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

And Can you tell me how to reuce the slack space? 

Thanks!
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

 

--- Quote Start ---  

originally posted by smalllight@Apr 10 2006, 03:26 PM 

hi,hippo! 

i build the boa in the arm platform,the message boa process is as follow:# cat status 

name: boa 

state:  s (sleeping) 

tgid: 60 

pid:    60 

ppid: 56 

tracerpid:      0 

uid:    0    0    0    0 

gid:    0    0    0    0 

fdsize: 32 

groups: 

mem:      157792 bytes 

slack:      2876 bytes 

shared:        0 bytes 

sigpnd: 0000000000000000 

sigblk: 0000000000000000 

sigign: 0000000000001a00 

sigcgt: 0000000000016443 

capinh: 0000000000000000 

capprm: 00000000fffffeff 

capeff: 00000000fffffeff 

 

can you show the boa process status in your nios platform? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14187) 

--- quote end ---  

 

--- Quote End ---  

 

Sorry for the delay, I was busy on a kernel issue. 

Here is boa status on nios2 

# cat status 

 

Name: boa 

State: S (sleeping) 

SleepAVG: 87% 

Tgid: 28 

Pid: 28 

PPid: 26 

TracerPid: 0 

Uid: 0 0 0 0 

Gid: 0 0 0 0 

FDSize: 32 

Groups: 

Mem: 286112 bytes 

Slack: 52682 bytes 

Shared: 0 bytes 

Threads: 1 

SigPnd: 0000000000000000 

ShdPnd: 0000000000000000 

SigBlk: 0000000000000000 

SigIgn: 0000000000001004 

SigCgt: 0000000000014643 

CapInh: 0000000000000000 

CapPrm: 00000000fffffeff 

CapEff: 00000000fffffeff#
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

Dear Hippo, 

We build our boa application in our platform! we list the status. 

and could you please send us you code of boa ,then we can compare them,  

 

our boa version 0.94# cat /proc/108/status 

Name: boa 

State: S (sleeping) 

SleepAVG: 89% 

Tgid: 108 

Pid: 108 

PPid: 89 

TracerPid: 0 

Uid: 0 0 0 0 

Gid: 0 0 0 0 

FDSize: 32 

Groups: 

Mem: 273568 bytes 

Slack: 71494 bytes 

Shared: 0 bytes 

Threads: 1 

SigPnd: 0000000000000000 

ShdPnd: 0000000000000000 

SigBlk: 0000000000000000 

SigIgn: 0000000000001004 

SigCgt: 0000000000016643 

CapInh: 0000000000000000 

CapPrm: 00000000fffffeff 

CapEff: 00000000fffffeff 

 

Best Regards, 

Fei WU  

e-mail: wfeiwu@21cn.com
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

 

--- Quote Start ---  

originally posted by feiwu@Apr 13 2006, 10:51 AM 

dear hippo, 

      we build our boa application in our platform! we list the status. 

      and  could you please send us you code of boa ,then we can compare them,     

   

our boa version 0.94# cat /proc/108/status 

name: boa 

state:  s (sleeping) 

sleepavg:    89% 

tgid: 108 

pid:    108 

ppid: 89 

tracerpid:      0 

uid:    0    0    0    0 

gid:    0    0    0    0 

fdsize: 32 

groups: 

mem:      273568 bytes 

slack:  71494 bytes 

shared:        0 bytes 

threads:        1 

sigpnd: 0000000000000000 

shdpnd: 0000000000000000 

sigblk: 0000000000000000 

sigign: 0000000000001004 

sigcgt: 0000000000016643 

capinh: 0000000000000000 

capprm: 00000000fffffeff 

capeff: 00000000fffffeff 

 

best regards, 

fei wu  

e-mail: wfeiwu@21cn.com 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14297) 

--- quote end ---  

 

--- Quote End ---  

 

it was in ~/apps/boa, which was ported by Microtronix.
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

Dear hippo! 

I compare the status of boa process in your platform and my arm platform. 

the result as follow: 

my arm platform: 

compare 

Mem: 157792 bytes 

Slack: 2876 bytes 

Shared: 0 bytes 

 

your nios platform: 

Mem: 286112 bytes 

Slack: 52682 bytes 

Shared: 0 bytes 

 

you can see nios plat forum user more memory than arm. 

In my arm platform, the linux sourse verision is 2.4 

if the application will consume more memory in the 2.6 kernel? 

can you help me?
0 Kudos
Altera_Forum
Honored Contributor II
1,291 Views

 

--- Quote Start ---  

originally posted by smalllight@Apr 17 2006, 11:05 AM 

dear hippo! 

i compare the  status of boa process in your platform and my arm platform. 

the result as follow: 

my arm platform: 

compare 

mem:      157792 bytes 

slack:      2876 bytes 

shared:        0 bytes 

 

your nios platform: 

mem: 286112 bytes 

slack: 52682 bytes 

shared: 0 bytes 

 

you can see nios plat forum user more memory than arm. 

in my arm platform, the linux sourse verision is 2.4 

if the application will consume more memory in the 2.6 kernel? 

can you help me? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14414) 

--- quote end ---  

 

--- Quote End ---  

 

I would expect Nios2&#39;s code efficency will not be as good as ARM&#39;s. Because Nios2 has fewer instruction set. 

 

To reduce memory usage, there are some approaches. 

1. rebuild the lib and code with "-Os" flag. 

2. in Linux 2.6.12 or later, there is a CONFIG_BASE_SMALL, which will use smaller table size for kernel data. 

3. hack the kernel or apps to reduce memory usage and slack.
0 Kudos
Reply