comp.lang.ada
 help / color / mirror / Atom feed
* gnatmem does not work (win2K)?
@ 2003-07-04 14:44 Frank Piron
  2003-07-07  7:06 ` Frank Piron
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Piron @ 2003-07-04 14:44 UTC (permalink / raw)


Hi,

i wrote a little package for simple
linked lists just for playing with
deallocation.

The package contains a recursive
deallocator function free and a debug
message in finalize shows that free
works like expected.

But when i run

> gnatmem list_test.exe 

then gnatmem says that no memory is 
deallocated.

OS is windows 2000.

Any idea?

Frank



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnatmem does not work (win2K)?
  2003-07-04 14:44 gnatmem does not work (win2K)? Frank Piron
@ 2003-07-07  7:06 ` Frank Piron
  2003-07-07  8:44   ` 
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Piron @ 2003-07-07  7:06 UTC (permalink / raw)


Hi,
Additionally i tried the example from
Gnat User's Guide:

------------------------------------------------------------
with Unchecked_Deallocation;
procedure Test_Gm is

   type T is array (1..1000) of Integer;
   type Ptr is access T;
   procedure Free is new Unchecked_Deallocation (T, Ptr);
   A : Ptr;

   procedure My_Alloc is
   begin
      A := new T;
   end My_Alloc;

   procedure My_DeAlloc is
      B : Ptr := A;
   begin
      Free (B);
   end My_DeAlloc;

begin
   My_Alloc;
   for I in 1 .. 5 loop
      for J in I .. 5 loop
         My_Alloc;
      end loop;
      My_Dealloc;
   end loop;
end;
------------------------------------------------------------
I compiled with debugging option -g and after that run
> gnatmem test_gm.exe
which results in the following output:
>
Global information
------------------
   Total number of allocations        :  17
   Total number of deallocations      :   0
   Final Water Mark (non freed mem)   :  62.52 Kilobytes
   High Water Mark                    :  62.52 Kilobytes

Releasing deallocated memory at :
--------------------------------
   test_gm.adb:17 test_gm.my_dealloc

Allocation Root # 1
-------------------
 Number of non freed allocations    :  16
 Final Water Mark (non freed mem)   :  62.50 Kilobytes
 High Water Mark                    :  62.50 Kilobytes
 Backtrace                          :
   test_gm.adb:11 test_gm.my_alloc

Allocation Root # 2
-------------------
 Number of non freed allocations    :   1
 Final Water Mark (non freed mem)   :  24 Bytes
 High Water Mark                    :  24 Bytes
 Backtrace                          :
   : system__machine_state_operations__allocate_machine_state
>

OS is win2k. Is this a known behaviour of gnatmem on win32
systems?

TIA, Frank



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnatmem does not work (win2K)?
  2003-07-07  7:06 ` Frank Piron
@ 2003-07-07  8:44   ` 
  0 siblings, 0 replies; 3+ messages in thread
From:  @ 2003-07-07  8:44 UTC (permalink / raw)


I tried it on Linux (Red Hat 7.3) and I get the same output as you 
(instead of the "correct" one from the User's Guide...)

I do not have ACT support. If you do, warn them about this issue.

Rodrigo

Frank Piron wrote:
> Hi,
> Additionally i tried the example from
> Gnat User's Guide:
> 
> ------------------------------------------------------------
> with Unchecked_Deallocation;
> procedure Test_Gm is
> 
>    type T is array (1..1000) of Integer;
>    type Ptr is access T;
>    procedure Free is new Unchecked_Deallocation (T, Ptr);
>    A : Ptr;
> 
>    procedure My_Alloc is
>    begin
>       A := new T;
>    end My_Alloc;
> 
>    procedure My_DeAlloc is
>       B : Ptr := A;
>    begin
>       Free (B);
>    end My_DeAlloc;
> 
> begin
>    My_Alloc;
>    for I in 1 .. 5 loop
>       for J in I .. 5 loop
>          My_Alloc;
>       end loop;
>       My_Dealloc;
>    end loop;
> end;
> ------------------------------------------------------------
> I compiled with debugging option -g and after that run
> 
>>gnatmem test_gm.exe
> 
> which results in the following output:
> 
> Global information
> ------------------
>    Total number of allocations        :  17
>    Total number of deallocations      :   0
>    Final Water Mark (non freed mem)   :  62.52 Kilobytes
>    High Water Mark                    :  62.52 Kilobytes
> 
> Releasing deallocated memory at :
> --------------------------------
>    test_gm.adb:17 test_gm.my_dealloc
> 
> Allocation Root # 1
> -------------------
>  Number of non freed allocations    :  16
>  Final Water Mark (non freed mem)   :  62.50 Kilobytes
>  High Water Mark                    :  62.50 Kilobytes
>  Backtrace                          :
>    test_gm.adb:11 test_gm.my_alloc
> 
> Allocation Root # 2
> -------------------
>  Number of non freed allocations    :   1
>  Final Water Mark (non freed mem)   :  24 Bytes
>  High Water Mark                    :  24 Bytes
>  Backtrace                          :
>    : system__machine_state_operations__allocate_machine_state
> 
> 
> OS is win2k. Is this a known behaviour of gnatmem on win32
> systems?
> 
> TIA, Frank





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-07  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-04 14:44 gnatmem does not work (win2K)? Frank Piron
2003-07-07  7:06 ` Frank Piron
2003-07-07  8:44   ` 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox