[lkml]   [2000]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Overcommittable memory
On Tue, 21 Mar 2000 09:06:13 +0100, you wrote:

>> >Write the program without recursion and you know at compile-time how
>> >much memory it will ever need in the worst case.
>> >There is always at least one page - so make sure you use less than that.
>> >You'll need to know the stack overhead of any c-library you use - so
>> >don't use it or figure it out. It is doable with open-source libraries.
>> TBH, I don't see the point. I know I have more than enough RAM to
>> handle most cases, and some extra swap for contingencies.
>Someone mentioned how hard it was to write "memory safe" apps for
>devices, considering how the stack is dynamically allocated. I pointed
>that this isn't that hard.
>Having enough RAM is fine for a pc. An embedded device running linux
>will likely
>be mass-produced with the minimum amount of RAM though.

Just don't use the system stack. If you design and test your app
thoroughly enough, you can be certain it never uses more than, say,
3874Kb of RAM for it and the kernel. So, you fit 4Mb, and know that
you're safe.

You can do quite a good job, I suspect, if you avoid using functions
like malloc() etc. Just use your own, static memory allocation, then
you know exactly how much RAM your process uses.

In fact, a dynamically expanding stack with a set limit (the amount of
RAM) is no worse than a fixed stack of that size...


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:57    [W:0.048 / U:5.812 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site