Memory Leaks with pointers

T

Tricky

Consider the following:
type a_t;
type a_t_ptr is access a_t;

type b_t;
type b_t_ptr is access b_t;

type a_t is array(integer range <>) of integer;
type b_t is array(integer range <>) of a_t_ptr;

begin

process
variable P : b_t_ptr;
begin

P := new b_t(1 to 10);

for i in 1 to 10 loop
p(i) = new a_t(1 to 10);
end loop;

DEALLOCATE(P);
wait;
end process;

have I just caused a memory leak by not deallocating all the elements
in the top level array? would you have to quit the simulator to free
it again, or just end the simulation?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top