[vtkusers] Delete problems
Dominik Szczerba
domi at vision.ee.ethz.ch
Sun Jul 16 04:55:30 EDT 2006
That's smarter, thanks for a hint.
--ds
Xiaofeng Zhao wrote:
> The following should also work:
>
> //scope to use a lot of memory
> vtkSmartPointer<...> ptr = New();
> //huge dataset occupies memory only in this scope
> //do something with the dataset
> ptr = 0;
>
> I don't think it is a common practice to introduce a local scope just
> for memory management.
>
>
> ----- Original Message ----- From: "Dominik Szczerba"
> <domi at vision.ee.ethz.ch>
> Cc: "vtkusers vtkusers" <vtkusers at vtk.org>
> Sent: Saturday, July 15, 2006 6:00 AM
> Subject: Re: [vtkusers] Delete problems
>
>
>> Mathieu, Amy, Utkarsh,
>> Thank you all for your hint on smart pointers, I am now perfectly fine
>> with them. However, as I understand now, I cannot explicitly free the
>> memory occupied by a big dataset I am not going to use anymore, is
>> that correct? I am thinking of a solution, is the below OK to use?
>>
>> {//scope to use a lot of memory
>> vtkSmartPointer<...> = New();
>> //huge dataset occupies memory only in this scope
>> //do something with the dataset
>> }
>> //memory automatically released without Delete()
>>
>> Or are there any better solutions?
>> Thanks for any hints,
>> regards,
>> Dominik
>>
>> --
>> Dominik Szczerba, Ph.D.
>> Computer Vision Lab CH-8092 Zurich
>> http://www.vision.ee.ethz.ch/~domi
>> _______________________________________________
>> This is the private VTK discussion list. Please keep messages
>> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
--
Dominik Szczerba, Ph.D.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi
More information about the vtkusers
mailing list