Hi!
> +#ifdef __linux__
> +#include <sys/sysinfo.h>
> +
> +static int getfreeram(void)
> +{
> +     int ret;
> +     struct sysinfo sysinformation;
> +
> +     ret = sysinfo(&sysinformation);
> +     if (ret != 0)
> +             return 0;
> +     return sysinformation.freeram;
> +}
> +#else
> +static int getfreeram(void)
> +{
> +     return 0;
> +}
> +#endif

I think that there is still the same problem as in the first version.
Are you sure that sysinfo.freeram is reasonable number? Because as far
as I understand it this nuber shows amount of ram that is not used
currently. So when you run the test inside of LTP testsuite the number
may be quite low as there may be a lot of data cached in the buffers
because buffers are flushed only when there is memory pressure.

I've checked docs for both fork() and pthread_create() and both of them
shall indicate that there are no resources to create process/thread by
setting errno to EAGAIN (fork() may additionally return ENOMEM too). So
we could create processes until counter is reached or we got ENOMEM
which should be 100% portable.

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to