Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualizackp

Posted 04 March 2013 - 08:11 AM

I cannot for the life of me find this memory leak. I keep getting this:

 

 (0, 0) : ERR : GC cannot free an object of type 'RenderComponent', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type '_builtin_objecttype_', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type 'dictionary', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type 'Sprite', it is kept alive by the application


I implement all of these functions:
   void addRef();

    void release();

    int getRefCount();

    void setGCFlag();

    bool getGCFlag();

 

in the constructor i set the refCount to 1

 

and when I create a script object I notify the garbage collector like so:

SpriteScripted* ScriptObjectCreationCache::SSFactory() {
    SpriteScripted* obj = new SpriteScripted();
    
    if (spriteType == NULL)
        spriteType = engine->GetObjectTypeByName("Sprite");
    engine->NotifyGarbageCollectorOfNewObject(obj, spriteType);
    
    return obj;
}

 

 

this happens whenever I use that object type as a member property of a complete angelscript class (a class not declared in c++). However, i dont have a problem when I use a c++ defined class in a limited scope such as 'Texture' in setSpriteWithName:

(angelscript code; I dont have problems with Texture but I do have leaks with Sprite)

class RenderComponenet : Component
{
    Sprite sprite;

    void setSpriteWithName(string name) {
        Texture texture(name);
        sprite.setTexture(@texture);
    }
}

 

If anyone can see that I'm missing anything please let me know.

 

Thank you.


#6izackp

Posted 04 March 2013 - 08:10 AM

I cannot for the life of me find this memory leak. I keep getting this:

 

 (0, 0) : ERR : GC cannot free an object of type 'RenderComponent', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type '_builtin_objecttype_', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type 'dictionary', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type 'Sprite', it is kept alive by the application


I implement all of these functions:
   void addRef();

    void release();

    int getRefCount();

    void setGCFlag();

    bool getGCFlag();

 

in the constructor i set the refCount to 1

 

and when I create a script object I notify the garbage collector like so:

SpriteScripted* ScriptObjectCreationCache::SSFactory() {
    SpriteScripted* obj = new SpriteScripted();
    
    if (spriteType == NULL)
        spriteType = engine->GetObjectTypeByName("Sprite");
    engine->NotifyGarbageCollectorOfNewObject(obj, spriteType);
    
    return obj;
}

 

 

this happens whenever I use that object type as a member property of a complete angelscript class (a class not declared in c++). However, i dont have a problem when I use a c++ defined class in a limited scope such as 'Texture' in this example:

(angelscript code; I dont have problems with Texture but I do have leaks with Sprite)

class RenderComponenet : Component
{
    Sprite sprite;

    void setSpriteWithName(string name) {
        Texture texture(name);
        sprite.setTexture(@texture);
    }
}

 

If anyone can see that I'm missing anything please let me know.

 

Thank you.


#5izackp

Posted 04 March 2013 - 08:05 AM

I cannot for the life of me find this memory leak. I keep getting this:

 

 

 (0, 0) : ERR : GC cannot free an object of type 'RenderComponent', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type '_builtin_objecttype_', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type 'dictionary', it is kept alive by the application

 (0, 0) : ERR : GC cannot free an object of type 'Sprite', it is kept alive by the application


I implement all of these functions:
   void addRef();

    void release();

    int getRefCount();

    void setGCFlag();

    bool getGCFlag();

 

in the constructor i set the refCount to 1

 

and when I create a script object I notify the garbage collector like so:

SpriteScripted* ScriptObjectCreationCache::SSFactory() {
    SpriteScripted* obj = new SpriteScripted();
    
    if (spriteType == NULL)
        spriteType = engine->GetObjectTypeByName("Sprite");
    engine->NotifyGarbageCollectorOfNewObject(obj, spriteType);
    
    return obj;
}

 

 

this happens whenever I use that object type as a member property of a complete angelscript class (a class not declared in c++). However, i dont have a problem when I use a c++ defined class in a limited scope such as 'Texture' in this example:

(angelscript code; I dont have problems with Texture but I do have leaks with Sprite)

class RenderComponenet : Component
{
    Sprite sprite;

    void setSpriteWithName(string name) {
        Texture texture(name);
        sprite.setTexture(@texture);
    }
}

 

If anyone can see that I'm missing anything please let me know.

 

Thank you.


#4izackp

Posted 04 March 2013 - 07:52 AM

I cannot for the life of me find this memory leak. I keep getting this:

 

GC cannot free an object of type 'Sprite', it is kept alive by the application
 

I implement all of these functions:
   void addRef();

    void release();

    int getRefCount();

    void setGCFlag();

    bool getGCFlag();

 

in the constructor i set the refCount to 1

 

and when I create a script object I notify the garbage collector like so:

SpriteScripted* ScriptObjectCreationCache::SSFactory() {
    SpriteScripted* obj = new SpriteScripted();
    
    if (spriteType == NULL)
        spriteType = engine->GetObjectTypeByName("Sprite");
    engine->NotifyGarbageCollectorOfNewObject(obj, spriteType);
    
    return obj;
}

 

 

this happens whenever I use that object type as a member property of a complete angelscript class (a class not declared in c++). However, i dont have a problem when I use a c++ defined class in a limited scope such as 'Texture' in this example:

(angelscript code; I dont have problems with Texture but I do have leaks with Sprite)

class RenderComponenet
{
    Sprite sprite;

    void setSpriteWithName(string name) {
        Texture texture(name);
        sprite.setTexture(@texture);
    }
}

 

 

 

 

 

 

If anyone can see that I'm missing anything please let me know.

 

Thank you.


#3izackp

Posted 04 March 2013 - 07:48 AM

I cannot for the life of me find this memory leak. I keep getting this:

 

GC cannot free an object of type 'RenderComponent', it is kept alive by the application
 

I implement all of these functions:
   void addRef();

    void release();

    int getRefCount();

    void setGCFlag();

    bool getGCFlag();

 

in the constructor i set the refCount to 1

 

and when I create a script object I notify the garbage collector like so:

SpriteScripted* ScriptObjectCreationCache::SSFactory() {
    SpriteScripted* obj = new SpriteScripted();
    
    if (spriteType == NULL)
        spriteType = engine->GetObjectTypeByName("Sprite");
    engine->NotifyGarbageCollectorOfNewObject(obj, spriteType);
    
    return obj;
}

 

 

this happens whenever I use that object type as a member property of a complete angelscript class (a class not declared in c++). However, i dont have a problem when I use a c++ defined class in a limited scope such as 'Texture' in this example:

(angelscript code)
    void setSpriteWithName(string name) {
        Texture texture(name);
        sprite.setTexture(@texture);
    }

 

 

 

If anyone can see that I'm missing anything please let me know.

 

Thank you.


#2izackp

Posted 04 March 2013 - 07:47 AM

I cannot for the life of me find this memory leak. I keep getting this:

 

GC cannot free an object of type 'RenderComponent', it is kept alive by the application
 

I implement all of these functions:
   void addRef();

    void release();

    int getRefCount();

    void setGCFlag();

    bool getGCFlag();

 

in the constructor i set the refCount to 1

 

and when i create a script object add notify the garbage collector like so:

SpriteScripted* ScriptObjectCreationCache::SSFactory() {
    SpriteScripted* obj = new SpriteScripted();
    
    if (spriteType == NULL)
        spriteType = engine->GetObjectTypeByName("Sprite");
    engine->NotifyGarbageCollectorOfNewObject(obj, spriteType);
    
    return obj;
}

 

 

this happens whenever I use that object type as a member property of a complete angelscript class (a class not declared in c++). However, i dont have a problem when I use a c++ defined class in a limited scope such as 'Texture' in this example:

(angelscript code)
    void setSpriteWithName(string name) {
        Texture texture(name);
        sprite.setTexture(@texture);
    }

 

 

 

If anyone can see that I'm missing anything please let me know.

 

Thank you.


PARTNERS