Computer Chess Club Archives


Search

Terms

Messages

Subject: Thanks Dan and Ulrich

Author: James Robertson

Date: 14:53:40 06/09/00

Go up one level in this thread


On June 09, 2000 at 16:56:56, Ulrich Tuerke wrote:

>On June 09, 2000 at 16:33:25, James Robertson wrote:
>
>>Will my program get sick if I write:
>>
>>int *a = new int[64];
>>int *b = a;
>>....
>>delete [] b;
>>
>>?
>>
>>This question stems from my lack of knowledge about how a program knows how much
>>memory it has allocated at runtime. That is to say, where does the program store
>>the size of a so the memory will be freed if you call delete []? If you try to
>>free this memory from another pointer (b) will it still know that 64 ints need
>>to be deleted?
>
>Yes, I think so. The memory allocation package of the library which you are
>using manages allocated addresses and corresponding sizes. The names of
>variables are irrelevant.
>
>Uli
>
>>
>>James

Thanks you and Dan for helping me with this.

James



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.