fix malloc whole page for small allocations?

Steve deRosier <[email protected]>
Newsgroups gmane.linux.uclinux.devel
Message-ID <CALLGbR+g0CqaHmxN+ma9hJo96Zy0=8f8Dc0jynRuEgvJf-ei4A@mail.gmail.com>
Hi all,

Every time our application mallocs any small number of bytes (<8k),
the device seems to malloc an entire page (8k). Does anyone know  why
this happens, and how I can fix it?

Full details:

This same application ran fine on a Linux 2.4.x (uClinux) platform,
but due to various reasons we've had to upgrade the platform to 3.3.0
(still uClinux). Coldfire mcf5235, 4 MB flash, 32 MB RAM. We're using
uClibc.

At the time we start the application, there is ~20 MB free, it runs
for 30+ seconds and then the OOM killer kills it. On the 2.4.x
platform, it has a high-water-mark of about 2 MB, and runs in the
steady-state at about 1.5 MB.

After much investigation (eventually culminating in a debug version of
malloc printing each allocation request, then sleeping for 2 seconds,
where I cat /proc/meminfo), we finally noticed that each allocation,
typically 10-40 bytes, reduces meminfos's MemFree by 8k.

Other than the underlying kernel and wholesale upgrade of the uClinux
base, nothing has really changed on the system. We're still selecting
the same packages and configuration as near as possible.

Thanks,
- Steve
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.