home *** CD-ROM | disk | FTP | other *** search
- program Buggy1;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: BUGGY1 }
-
- { This programs demonstrates the fact that you
- need to allocate memory for a pointer before
- you use it. If you don't allocate the memory,
- you risk generating a GPF.
-
- Set HeapLimit to zero when you are trying to
- discover memory leaks in your programs. It
- helps you track down errors by increasing the
- likelihood that pointer errors will raise
- exceptions at the place in your code where
- the trouble begins. In other words, the error
- is less likely to show up later, and more likely
- to show up at exactly the place in your code
- where you forgot to allocate, dispose, or dereference
- memory.
- }
-
- uses
- WinCrt;
-
- {$R+,S+}
-
- type
- PString = ^String;
-
- var
- MyString: PString;
-
- begin
- HeapLimit := 0;
- MyString^ := 'Hello';
- WriteLn(MyString^);
- end.
-
-