Answer the question
In order to leave comments, you need to log in
dynamic structures. Is the dispose() procedure required?
In the Pascal language textbook, the procedure for removing an element from the stack is described as follows:
Procedure ReadStack(var u: pt; var dig: integer);
var x: pt;
begin
dig := u^.Data; // извлекаются данные из верхнего элемента стека
x := u; // сохраняется ссылка на верхний элемент
u := u^.Next; // вершиной стека становится следующий элемент
Dispose(x); // очищается память из под извлеченного элемента
end;
Procedure ReadStack(var u: pt; var dig: integer);
begin
dig := u^.Data; // извлекаются данные из верхнего элемента стека
u := u^.Next; // вершиной стека становится следующий элемент
end;
Answer the question
In order to leave comments, you need to log in
1) Pascal has no GC and no built-in smart references, and the absence of references does not change anything.
2) Yes.
3) No, C does not automatically collect garbage.
GC is definitely built into C#, and apparently in other .Net languages, although I'm not exactly sure
I think it's good form, even if it's not used in PL, maybe the OS also monitors this, I'm not a professional, so I can't say for sure can. When I wrote a batch image resize in C#, after I inserted Image.Dispose() into the ResizeImage procedure (stealed from somewhere in the network) at the end after forming the transformed image, the memory consumption was reduced by 100-200 meters.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question