Skip to content

Commit

Permalink
Make Vector memory reported
Browse files Browse the repository at this point in the history
  • Loading branch information
alexp-sssup committed May 1, 2012
1 parent fa5b395 commit a20efa6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/scripting/toplevel/Vector.cpp
Expand Up @@ -80,7 +80,7 @@ void Vector::sinit(Class_base* c)
c->prototype->setVariableByQName("unshift",AS3,Class<IFunction>::getFunction(unshift),DYNAMIC_TRAIT);
}

Vector::Vector(Class_base* c):ASObject(c),vec_type(NULL)
Vector::Vector(Class_base* c):ASObject(c),vec_type(NULL),vec(reporter_allocator<ASObject*>(c->memoryAccount))
{
}

Expand Down Expand Up @@ -170,7 +170,7 @@ ASFUNCTIONBODY(Vector,_concat)
Vector* ret= (Vector*)obj->getClass()->getInstance(true,NULL,0);
// copy values into new Vector
ret->vec.resize(th->size(), NULL);
std::vector<ASObject*>::iterator it=th->vec.begin();
auto it=th->vec.begin();
uint32_t index = 0;
for(;it != th->vec.end();++it)
{
Expand All @@ -188,7 +188,7 @@ ASFUNCTIONBODY(Vector,_concat)
{
Vector* arg=static_cast<Vector*>(args[i]);
ret->vec.resize(index+arg->size(), NULL);
std::vector<ASObject*>::iterator it=arg->vec.begin();
auto it=arg->vec.begin();
for(;it != arg->vec.end();++it)
{
if (*it)
Expand Down Expand Up @@ -452,7 +452,7 @@ ASFUNCTIONBODY(Vector, _reverse)
{
Vector* th = static_cast<Vector*>(obj);

std::vector<ASObject*> tmp = std::vector<ASObject*>(th->vec);
std::vector<ASObject*> tmp = std::vector<ASObject*>(th->vec.begin(),th->vec.end());
uint32_t size = th->size();
th->vec.clear();
th->vec.resize(size, NULL);
Expand Down
2 changes: 1 addition & 1 deletion src/scripting/toplevel/Vector.h
Expand Up @@ -30,7 +30,7 @@ class Vector: public ASObject
{
Type* vec_type;
bool fixed;
std::vector<ASObject*> vec;
std::vector<ASObject*, reporter_allocator<ASObject*>> vec;
int capIndex(int i) const;
class sortComparatorWrapper
{
Expand Down

0 comments on commit a20efa6

Please sign in to comment.