tag:blogger.com,1999:blog-1720439865889190419.post3454301518627382051..comments2023-03-25T13:51:50.278+01:00Comments on C Spangled: Safe memory usage in C# part 1/2Alberthttp://www.blogger.com/profile/15599692262672037932noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-1720439865889190419.post-21106395763503738292010-09-13T14:09:18.762+02:002010-09-13T14:09:18.762+02:00I like the fish tank..I like the fish tank..Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-52206860686176586212010-08-04T20:04:45.736+02:002010-08-04T20:04:45.736+02:00Hi Anonymous, and thanks for the comment.
Please ...Hi Anonymous, and thanks for the comment.<br /><br />Please see the msdn documentation for Bit Array http://msdn.microsoft.com/en-us/library/system.collections.bitarray.aspx - it basically says that it pigeonholes 8 bit values into the same byte, so the 1/8 argument stands. :)Alberthttps://www.blogger.com/profile/15599692262672037932noreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-90757722506771394712010-08-04T15:28:35.702+02:002010-08-04T15:28:35.702+02:00As if the bounds array took only 1/8 of the mem ar...As if the bounds array took only 1/8 of the mem array! Yes, you only need one bit to be set to be true, but each memory address points to a byte. So, unless your bool array uses byte masks to test for truth, the bounds array is actually as big as your mem array. And linear time is not the best you can get with memory management...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-566363455802165972010-07-26T17:06:40.674+02:002010-07-26T17:06:40.674+02:00Wow... Just wow...
Why don't you try looking ...Wow... Just wow...<br /><br />Why don't you try looking at how malloc() works in real systems.<br /><br />http://gee.cs.oswego.edu/dl/html/malloc.htmlAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-2143598661396696802010-07-07T22:49:16.843+02:002010-07-07T22:49:16.843+02:00The real problem with this is that this implementa...The real problem with this is that this implementation is really naive and inefficient. <br /><br />First malloc and free take a long time to finish and second it is a memory hog. <br /><br />You should learn some data structures or something. I guess being bad at programming comes with being a C# programmer :DAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-77138259382798789882010-07-07T22:33:44.554+02:002010-07-07T22:33:44.554+02:00Why do you need a boolean array for every byte? T...Why do you need a boolean array for every byte? This is a stupid implementation of malloc.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-31366888980987455312010-04-22T00:25:56.091+02:002010-04-22T00:25:56.091+02:00Hi, thanks for the comments. I am glad to see tha...Hi, thanks for the comments. I am glad to see that leaving anonymous comments open was not in vain.<br /><br />Anonymous: Nice plumber parable *zing*-er. :) While I know your comment was made in jest, I would like to point out that being a plumber for 6 years does mean you do get quite good at knowing which pipes to use for which occasions.<br /><br />peterchen: I can assure you, it *does* work. I would not write up an entire post about this unless I had working test code. :) In the soon-to-come part #2, I will attach the entire solution.Alberthttps://www.blogger.com/profile/15599692262672037932noreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-67198211502739876972010-04-19T23:05:01.889+02:002010-04-19T23:05:01.889+02:00Oh. My. Procreating. Deity. In what culture is the...Oh. My. Procreating. Deity. In what culture is there a seventeenth fool day?<br /><br />But if I told you it wouldn't even work, `you'd come up with something more convoluted.peterchennoreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-46795884520326321982010-04-19T15:39:55.932+02:002010-04-19T15:39:55.932+02:00Being a plumber for six years doesn't automagi...Being a plumber for six years doesn't automagically mean that you're a good plumber.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-63288151172853323522010-04-19T15:14:53.336+02:002010-04-19T15:14:53.336+02:00Don't forget, he has 6 years of system develop...Don't forget, he has 6 years of system development...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1720439865889190419.post-80576789230181001932010-04-19T13:09:25.070+02:002010-04-19T13:09:25.070+02:00This is insane. Object pools are not used to prev...This is insane. Object pools are not used to prevent out of memory errors. If you need to make sure you always have a bunch of Foo objects, you should just use an object pool instead of rolling your own free and malloc. Your 'safe memory usage' is not safe at all, for the love of Christ.Anonymousnoreply@blogger.com