[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot allocate memory



Daniel Fraile Vergel wrote:
> Hi, I am involved in the design of a control system for a CWDM
> equipment. I am using SNMP protocol, so I've write a little snmp daemon.
> This software works fine in my PC, it compiles without errors with gcc
> compiler. When I run the daemon, a memory allocation error (snmpd: error
> while loading shared libraries: libsnmp.so.3: cannot load shared object
> file: Cannot allocate memory) raises and the application crashes. 
> I'm using an standard devboard lx, with 8mb of memory. Could someone
> tell me what I'm doing wrong?. If I need to increase the amount of
> memory available, what chip is necessary?, and how I replace the chip?

I don't know if you're doing anything wrong, but there are a couple of 
things that can help you reduce the memory usage.  First of all, 
depending on how you build and install your application and libraries, 
you might want to check that they are stripped.  (This can be done 
manually with 'strip-cris --strip-unneeded'; normally it's done 
automatically during 'make install'.)  The other thing might be to link 
statically against one or more of the libraries your snmp deamon uses. 
For example, instead of just linking against libsnmp, you can wrap it in 
something like this: -Wl,-Bstatic -lsnmp -Wl,-Bdynamic.  This can be 
beneficial if only one application uses a library, and only small 
portions of it.

-- 
Orjan Friberg
Axis Communications