<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-7774421.post8275482744899067086..comments</id><updated>2009-05-10T01:25:51.934+05:30</updated><title type='text'>Comments on Bad Stream, No Consciousness: Math or Common Sense?</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.srinivas.co.in/feeds/8275482744899067086/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default'/><link rel='alternate' type='text/html' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html'/><author><name>Srinivas</name><uri>http://www.blogger.com/profile/03433373483562224720</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7774421.post-7786969374714442086</id><published>2009-05-10T01:25:00.000+05:30</published><updated>2009-05-10T01:25:00.000+05:30</updated><title type='text'>Ah! The joys of memory leaks :)

Well, in addition...</title><content type='html'>Ah! The joys of memory leaks :)&lt;br /&gt;&lt;br /&gt;Well, in addition to math and common sense, may I suggest another option? Engineering.&lt;br /&gt;&lt;br /&gt;1. Custom memory management: Having your own memory manager that for example, uses an arena allocation scheme could ensure that you can gracefully handle OOM cases, per 'sub-task' as you said (by giving each task it's own arena). Also, there is the benefit that you don't have to go re-write your entire codebase to handle OOM. You could just have your manager override libc's *alloc calls and put in all your graceful handling there.&lt;br /&gt;&lt;br /&gt;2. A really brave (difficult but most effective?) solution would be to implement gargbage collection. It really makes sense in memory constrained environments. And no - it's not as performance-expensive as it used to be. There has been tonnes of research on making gc faster and there are practical solutions that work very well.&lt;br /&gt;&lt;br /&gt;Admittedly, No. 2 is very ambitious and may not be feasible - but I think No. 1 is just a couple of man-week's of work at worst.&lt;br /&gt;&lt;br /&gt;As for the case that you mentioned always succeeds - in a really constrained+leaking environment, it's likely that your blocking call will block infinitely, which is as bad as, if not worse than, crashing - don't you think?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default/7786969374714442086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default/7786969374714442086'/><link rel='alternate' type='text/html' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html?showComment=1241898900000#c7786969374714442086' title=''/><author><name>Sub Zero</name><uri>http://www.blogger.com/profile/13704362196608060346</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html' ref='tag:blogger.com,1999:blog-7774421.post-8275482744899067086' source='http://www.blogger.com/feeds/7774421/posts/default/8275482744899067086' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-7774421.post-5888722381428948336</id><published>2009-05-08T15:04:00.000+05:30</published><updated>2009-05-08T15:04:00.000+05:30</updated><title type='text'>do you just want me to re-read it or did you want ...</title><content type='html'>do you just want me to re-read it or did you want to make a point there? I didn't get your last comment...Maybe you didn't get my point then :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default/5888722381428948336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default/5888722381428948336'/><link rel='alternate' type='text/html' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html?showComment=1241775240000#c5888722381428948336' title=''/><author><name>Murali</name><uri>http://www.blogger.com/profile/05655502176891047744</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html' ref='tag:blogger.com,1999:blog-7774421.post-8275482744899067086' source='http://www.blogger.com/feeds/7774421/posts/default/8275482744899067086' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-7774421.post-4244793941551914102</id><published>2009-05-08T13:05:00.000+05:30</published><updated>2009-05-08T13:05:00.000+05:30</updated><title type='text'>Quoting from my "Common Sense" paragraph: 

"You s...</title><content type='html'>Quoting from my "Common Sense" paragraph: &lt;br /&gt;&lt;br /&gt;"You still may need to do some sizing - but this would just be to ensure that you do not hit out of memory conditions very frequently and nothing more than that"</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default/4244793941551914102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default/4244793941551914102'/><link rel='alternate' type='text/html' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html?showComment=1241768100000#c4244793941551914102' title=''/><author><name>Srinivas</name><uri>http://www.blogger.com/profile/03433373483562224720</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='13472165452976580107'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html' ref='tag:blogger.com,1999:blog-7774421.post-8275482744899067086' source='http://www.blogger.com/feeds/7774421/posts/default/8275482744899067086' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-7774421.post-3732434698401935643</id><published>2009-05-08T11:42:00.000+05:30</published><updated>2009-05-08T11:42:00.000+05:30</updated><title type='text'>I think I'm missing something here, but shouldn't ...</title><content type='html'>I think I'm missing something here, but shouldn't it the ideal situation be "Math + Common Sense"?&lt;br /&gt;&lt;br /&gt;Lemme elaborate...&lt;br /&gt;To sum up your "common sense" section, an application/algorithm CANNOT afford to ignore out of memory situations and should do sufficient error checking. If I missed something that u wanted to say here, heLu...&lt;br /&gt;&lt;br /&gt;So, my point is, when u're writing something you end up doing both math and common sense alva? You make a rough estimate that these are gonna be my memory requirements, based on the data structures u choose (keeping in mind the algorithm complexity, an excellent point that u made)...And then u go about coding in a way that doesn't break the application, something like&lt;br /&gt;&lt;br /&gt;ptr = calloc&lt;br /&gt;if ( ptr == NULL )&lt;br /&gt;handle gracefully&lt;br /&gt;&lt;br /&gt;Am I making sense?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default/3732434698401935643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7774421/8275482744899067086/comments/default/3732434698401935643'/><link rel='alternate' type='text/html' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html?showComment=1241763120000#c3732434698401935643' title=''/><author><name>Murali</name><uri>http://www.blogger.com/profile/05655502176891047744</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.srinivas.co.in/2009/05/math-or-common-sense.html' ref='tag:blogger.com,1999:blog-7774421.post-8275482744899067086' source='http://www.blogger.com/feeds/7774421/posts/default/8275482744899067086' type='text/html'/></entry></feed>