Search This Blog

Sunday, November 05, 2006

Memory Troubles in C++

Peace be upon you

today it's a little strange topic :D, I will talk about memory & Stack"the precious thing for c++ developers",
I will tell you some troubles that you could meet,
  1. Memory Allocation and De-allocation.
  2. Memory fragmentation.
  3. Heap over flow.
  4. Stack over flow.
  5. Buffer over flow.
  6. which to use ( Virtual memory or heap )

ahhhhh, all of this could turn your life into hell if you don't use it right, if you miss use memory or stack, you will start cutting your hear one by one :D

first of all when you miss use "Memory Allocation and De allocation." you got something called memory leaks, which means that you ask operating system to allocate some memory space, and operating system reserve it for you.

all of that is cool, but where is the problem

the problem that when you don't allocate the memory, the memory still reserved, which means that you eat some of system memory which will cause slow down the whole system by time,

to avoid that you may be aware of your pointers and allocated memory, or you can use the smart pointers, it got a very cool solution for this problem,

the second one is memory fragmentation, this one is amazing :D this one may make you kill your self :D because it's so hard to find, the only way to find it is to check up the design or your code, memory fragmentation came by allocating and deallcating memory in high frequently way, I mean allocating 500 bytes 30000 times, this may cause memory fragmentation, the only way to solve this problem is to allocate enough piece of memory and keep working on it.

Heap over flow, this bug is simple one and you can avoid it by check your heap space and data you want to put, from it's name you can guess that it happen when you try to put a lot of data in not enough space, this will cause application crash,

Buffer over flow, this one may turn your application into a virus host, HOW COULD IT BE? simple the buffer you allocate in stack , when you exceed it you will be able to put SHELL CODE and run it as much as u want, this topic is little complicated ( you have to know the STACK object and heap object ), also you should know the dynamics of stack and stack pointer.

stack over flow, this happen by recursive calls, you should solve it by doing some algorithm with good design that a void this problem,

the virtual memeory, it's cool but how to use it, I think you should use it when your data exceed the limit of 1 or 2 mega, and do some algorithm that synchronous the data between the virtual memory and the heap,

I think the final word is before you start doing C++ code, write a good class for memeory management to have some peace while you writing the rest of the application.

thanks for reading this

thanks for trusting me ;)




at last :D

Please can you kick it? :Dkick it on DotNetKicks.com

More about ASP.NET book -> Using Webservice right

Peace be upon you

first of all, all written here is my own opinion and it mustn't be right all time :D,

someone send me and ask me to talk about "Using Web Service right."
this is issue !!!
really I mean it, a lot of people mess use it, Web service is amazing but over reacting with it cause a lot of problems to ur application, you have to use it wisely, you can make a 100% integratable system but you will also get a 100% unmaintainable system,
Web service has a lot of aspect that you have to care about when you are designing your system, and also you have to know that the decision of using the Web service must came in the architecture design level, before anything you have to decide that usage of your resources,

web service require more security + more Performance wise,
what I really like about web service is it's absolute control in your application against your customer, also you can do a great business by web service.

I will continue if I saw any comment :D, I will not keep writing to my self all time :D

Iterative Enhanced Waterfall model

Peace be upon you

It seems wired what I am talking about, some people like the idea of iterative development which is implicitly includes waterfall model, no one can deny that the most important model is waterfall, because it the base of all other models, what I am thinking is to merge the both iterative and Enhanced waterfall model.
this style will grantee highest insurance of right software, but it will consume some time, about 10 to 20 %, but I think this is fear percentage for getting right software, it will not make a big difference with small software, but it will be amazing and helpful for large software, that it's requirement is unsatable, I think this topic needs some sort of discussion to find how much we can get from it,
anyways I wish to see any comments for this topic :D I know

thanks for reading this


Kick it for me :) kick it on DotNetKicks.com
There was an error in this gadget