POV-Ray : Newsgroups : povray.binaries.programming : My idea: Developers need tips! Help me, please! : Re: My idea: Developers need tips! Help me, please! Server Time
25 Apr 2024 23:01:13 EDT (-0400)
  Re: My idea: Developers need tips! Help me, please!  
From: clipka
Date: 11 Sep 2016 17:00:03
Message: <57d5c5d3$1@news.povray.org>
Am 11.09.2016 um 22:06 schrieb LanuHum:
> We continue to
> https://github.com/Lanuhum/Blender-C-
> Seeking a memory leak.

The name of the repo is poorly chosen: Pasting the corresponding link
into plain text such as a mail, software that auto-detects links in
plain text may think the trailing `-` isn't part of the link (this is
quite obviously the case with Thunderbird).

I would recommend renaming the repo to, e.g., "Blender-Cpp".

> If you decide the problem - I will continue. I'll connect povray with blender.
> :)))

You're not very familiar with C++, are you?

One property of C++ is that there is no garbage collection in the
language itself, and you'll have to actively release all memory you
allocate. Thus, in the main() function,

    int main(int argc,char *argv[]){
        FXApp application("foxray",FXString::null);
        application.init(argc,argv);
        new ImageWindow(&application);
        application.create();
        return application.run();
    }

the `new ImageWindow(&application);` will allocate memory for, and
create, an object of type `ImageWindow`, but makes no provision to
remember the address of the memory allocated, so there is no way to
release the memory later.

You probably want to do something like this:

    ImageWindow myWindow = new ImageWindow(...);
    ...
    delete myWindow;

One memory leak eliminated. I'll have a look whether I can find some more.


Post a reply to this message

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