Comments on: Premature Optimization http://www.geekherocomic.com/2009/05/11/premature-optimization/ The geeky adventures of Randie Tue, 09 Feb 2010 12:36:17 +0000 http://wordpress.org/?v=2.8.4 hourly 1 By: etb http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2131 etb Thu, 14 May 2009 20:54:05 +0000 http://www.geekherocomic.com/?p=759#comment-2131 what AhmedG meant is that free() releases the memory allocated with malloc(). Saying `allocated using C' may let think that this code has sense: int a; free(&a); while it does not. The point is: malloc() gives you a piece of memory, and this piece of memory will be there until you release it explicitly with free(). If you lose the address of the piece of memory you cannot use it anymore, but it will be still there. It is wasted space. what AhmedG meant is that free() releases the memory allocated with malloc().

Saying `allocated using C’ may let think that this code has sense:
int a;
free(&a);
while it does not.

The point is: malloc() gives you a piece of memory, and this piece of memory will be there until you release it explicitly with free().
If you lose the address of the piece of memory you cannot use it anymore, but it will be still there. It is wasted space.

]]>
By: AhmedG http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2115 AhmedG Wed, 13 May 2009 11:53:18 +0000 http://www.geekherocomic.com/?p=759#comment-2115 @karmanya malloc() is a function in C used to "allocate" memory (set it aside for a specific purpose), free() is a function in C that frees the memory allocated using C. I'm not well veresed in C so I'm not sure how much that helps. Perhaps Salvatore can explain further. @karmanya

malloc() is a function in C used to “allocate” memory (set it aside for a specific purpose), free() is a function in C that frees the memory allocated using C.

I’m not well veresed in C so I’m not sure how much that helps. Perhaps Salvatore can explain further.

]]>
By: wareya http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2113 wareya Wed, 13 May 2009 10:39:25 +0000 http://www.geekherocomic.com/?p=759#comment-2113 Premature Optimization, leaks like there's no tomorrow, leaking preferable to taking time to free()... I smell a pun! Premature Optimization, leaks like there’s no tomorrow, leaking preferable to taking time to free()… I smell a pun!

]]>
By: dantotheman http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2112 dantotheman Wed, 13 May 2009 06:32:05 +0000 http://www.geekherocomic.com/?p=759#comment-2112 Ahh, this explains his preffernce for VB... Ahh, this explains his preffernce for VB…

]]>
By: karmanya http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2111 karmanya Tue, 12 May 2009 15:46:58 +0000 http://www.geekherocomic.com/?p=759#comment-2111 I didn't get this one. I didn’t get this one.

]]>
By: wired http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2109 wired Tue, 12 May 2009 11:15:00 +0000 http://www.geekherocomic.com/?p=759#comment-2109 owned =] owned =]

]]>
By: progfou http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2107 progfou Tue, 12 May 2009 04:23:49 +0000 http://www.geekherocomic.com/?p=759#comment-2107 @larethian for that, using static storage for everything, he would have need to know the concept of virtual memory, allowing to use more space than the single RAM can stand... do you really think he knows that? ;-) @larethian for that, using static storage for everything, he would have need to know the concept of virtual memory, allowing to use more space than the single RAM can stand… do you really think he knows that? ;-)

]]>
By: larethian http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2106 larethian Tue, 12 May 2009 01:47:48 +0000 http://www.geekherocomic.com/?p=759#comment-2106 Ross knows how to use malloc()? Shouldn't he be using static storage for everything? And putting everything in global space for easy access muahahahaha! but like Roman said, the punchline was stupendous! =) Ross knows how to use malloc()? Shouldn’t he be using static storage for everything? And putting everything in global space for easy access muahahahaha!

but like Roman said, the punchline was stupendous! =)

]]>
By: Roman Cheplyaka http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2104 Roman Cheplyaka Mon, 11 May 2009 17:14:34 +0000 http://www.geekherocomic.com/?p=759#comment-2104 "It leaks like there's no tomorrow." -- excellent :) “It leaks like there’s no tomorrow.” — excellent :)

]]>
By: GNUbie http://www.geekherocomic.com/2009/05/11/premature-optimization/comment-page-1/#comment-2103 GNUbie Mon, 11 May 2009 12:13:56 +0000 http://www.geekherocomic.com/?p=759#comment-2103 Boris' cover is getting thinner and thinner. I think we will soon see the end of his mission.... Boris’ cover is getting thinner and thinner. I think we will soon see the end of his mission….

]]>