Size Optimization for an embedded system

Apr 02, 2007 19 Replies

I have a few questions aregarding size optimization :



  1. I have already applied the linux kernel Tiny patch but I need to further reduce the size of the kernel.Any suggestions?
  2. Is there a tool with low memory footprint to find out the dynamic memory usage of applications during runtime?Applications like iptables,ebtables etc that cannot be made to run in background?
  3. Is there any freeware tool that helps find unused functions correctly by parsing some huge C/C++ source code?

Any suggestions would be welcome.Thanks.



-Wunused-function is a gcc option which you could consider for (3)

I've never used it but you might look at

formatting link

Why would you run the iptables program in the background? And what difference to memory usage would it make?

The iptables program simply loads configuration data into the kernel to control the kernel's netfilter functions.

In comp.os.linux.development.system jeniffer wrote in part:

Use an older kernel. 2.4 uses less RAM than 2.6 .

`ps` and `top` are the standards. They do multiple-count shared usage (libs).

Your compiler should issue warnings. Then you can lump all the unused functions together to avoid wasting parts of pages. Optimizing the library (find a good one) can be done to the same end.

formatting link
formatting link

may give you some ideas.

-- Robert

If you tell the compiler -ffunctions-section and then tell the linker --gc-sections, unused functions will be discarded. Adding the -fdata-sections to the compiler flags will do the same thing for variables.

Grant Edwards grante Yow! .. the MYSTERIANS are at in here with my CORDUROY visi.com SOAP DISH!!

at

formatting link

Thank you. But libraryopt is a tool to reduce the shared libraries by eliminating unused functions with respect to a set of binaries and not the binaries itself.

Thanks a lot.I want to run iptables in the background (even for the time it takes to add a rule or display all chains) because I do a cat / proc/meminfo before the background application runs and while the application is running in the background to find out the RAM requirement. Iptables might use malloc etc ..Since it makes its own data structures before doing a final setsockopt() on the kernel,I think it would make difference to memory usage.

wrote in part:

formatting link

Thank u for ur input :) I cannot use 2.4 neither ps or top are supported. I would try the warnings part though

What do you mean by 'not supported', compiling these tools for your platform can't be that hard ?

:wq ^X^Cy^K^X^C^C^C^C

You do a meminfo check before and after running iptables in order to get the memory usage of iptables. Fine. But why do you think the memory reqs are different? Also, how can you be sure that Iptables is "done" when you have it in the bg when you run the meminfo check the second time?

With all due respect, that's utter nonsense. I'm sure that Linux has supported 'ps' since before version 1.0, by a sizable margin. I probably still have a CD from a time before RedHat was a word, to prove it. 'top' may have come a bit later, but definitely before version 2.0.

[Please note and respect the F'up2]

Really? Just how did you come to that erroneous conclusion?

--

formatting link

ps and top have memory requirements .The busybox that I use doesnt have ps or top applets compiled into.I know I can compile them into it.I use the file /proc/meminfo - the very file ps and top use.kill and top come in the Process utilities sections of busybox that can very well be compiled to.

And you are implying that's not true for a 2.6 kernel?

None of which answeres the question of how you came to the conclusion that 2.4 kernels don't support ps and top.

Grant Edwards grante Yow! Let's send the at Russians defective visi.com lifestyle accessories!

And what does any of that have to do with kernel versions?

--

formatting link

BUT why? i'm also interested to know like others that what on earth you cann't use ps with 2.4? what linux port you are trying to use? You may eliminate the unused drivers that your hardware will never use. Is mini kernel an option to you?

ali

I think there has been a misunderstanding here. I suspect the OP meant something more like "I cannot use 2.4 and neither ps or top are supported (in my setup)."

Robert

Posted via a free Usenet account from http://www.teranews.com

Thanks Robert. I meant this only. I cannot use ps and top in my setup .I am not saying anything about the availability/non availability of ps and top with 2.4 ! I have already applied mini kernel option. I just want to know of a tool that can give me dynamic memory usage of an application that cannot be run on background!

I.C. Cann't understand your point of dynamic memory;-) Do you mean that what memeory your process will use at runtime? Anyway, just thought that if you area that much worried about your memory and kernel size then how about removing the virtual memory stuff at all. Don't know if its gonna work or not just a thought of mine. Yeah, using physical addresses, for sure it will make life bit hard but you maybe able to reduce the size drastically.

ali

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required