Clears unused stack of the current thread.
Unit
ELowLevel
Syntax
Code (Delphi)
|
procedure MemWipeStack;
|
Remarks
This function wipes (clears) the content of the unused part of the stack. The wipe is performed with debug pattern ($CCCCCCCC).
This means that when execution goes further - the uninitialized local variables will have non-0, non-nil, unaccessible value. This can help catch use of uninitialized variables.
Additionally, clearing stack can help to reduce number of false-positive entries with RAW stack tracing.
We recommend to call this function from time to time. For example, when application is idle, or about to do some heavy work.
Warning
|
It is highly recommended to call the function first to determinate if the MemWipeStack function should be called.
|
Caution!
|
This function clears the entire unused stack to the end. E.g. if you use 1 Mb stack (default) - then 1 Mb of memory will be written (except the busy part of the stack). Therefore, do not call this function too frequently, otherwise your performance will suffer.
Use with caution when stack size is greatly increased.
|
Examples
Code (Delphi)
|
procedure TForm1.ClearStackOnIdle(Sender: TObject; var Done: Boolean);
begin
if CanCallMemWipeStack then
MemWipeStack;
Done := True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnIdle := Self.ClearStackOnIdle;
end;
|
See also
Send feedback...
|
Build date: 2024-12-19
Last edited: 2024-12-19
|
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation.
We do not use your e-mail address for any other purpose.
We will remove your e-mail address from our system after the issue you are reporting has been resolved.
While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback.
After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.
Permanent link to this article: https://www.eurekalog.com/help/eurekalog/topic_function_elowlevel_memwipestack.php
|
|