deleting in the right order.
I know that you are suppose to delete in the opposite order theat you allocate, but what happens if you do not? I tried it in the wrong order and things seemed to run fine. Will I have a bad memory leak if I delete out of order?
Delete what in the wrong order? The order matters with some things, it doesn''t with others.
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
You''re probably confused by the fact that you''re supposed to release COM objects in the reverse order they were acquired. Memory is totally different.
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
I did not know that it matters with some things and not others. How will I know what it matters with and what it does not matter with?
January 16, 2002 08:56 PM
ahh Oluseyi you are right. It was COM obj I was looking at. So for allocating memory to a char array I don''t have to worry about order, but just for COM? Thank you.
ahh Oluseyi you are right. It was COM obj I was looking at. So for allocating memory to a char array I don''t have to worry about order, but just for COM? Thank you.
Well, some cases you do ie
Can''t free the head pointer, then try to free the children. Just an example for the new guys.
typedef struct sList{ int iData; struct sList *pNext;} tList;//code{ tList *pList; pList = (tList *)malloc(sizeof(tList)); pList->iData = 0; pList->pNext = (tList *)malloc(sizeof(tList)); // do something free(pList); free(pList->pNext); // oops!}
Can''t free the head pointer, then try to free the children. Just an example for the new guys.
My Gamedev Journal: 2D Game Making, the Easy Way
---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement