POV-Ray : Newsgroups : povray.off-topic : c++ memory question : Re: c++ memory question Server Time
11 Oct 2024 11:12:23 EDT (-0400)
  Re: c++ memory question  
From: Vincent Le Chevalier
Date: 2 Oct 2007 18:45:37
Message: <4702ca11$1@news.povray.org>

> Hi,
> 
> It's probably a stupid question, but here goes. I know that for every 
> "new", there must be a delete. I don't deal with malloc statements, so 
> let's disregard that branch of memory management.
> 
> So here's the question. If I create an array like so: int i[20];, and 
> then proceed to assign values for each entry, must I then delete it at 
> some point? I didn't use a new flag. Is the memory used by that array 
> freed after the program is terminated?
> 

What you make whith the instruction int i[20]; is a static array, that 
is allocated in the stack if I remember correctly. You do not have to 
manage the memory in the stack, so no free or delete.

Try googling for "static dynamic array C++", it should bring you 
something useful...

Hope this helps

-- 
Vincent


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.