Jump to content
  • Advertisement
Sign in to follow this  
polyfrag

STL list memory leak?

This topic is 2152 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If I don't call clear(); on the list before I assign it something else, there's a memory leak.


	towrite->brushes.clear();
	towrite->brushes = g_edmap.m_brush;

I tried reproducing the problem with lists of a simple dummy class but it doesn't leak memory like the code above.

 

The variables above are of type list<EdBrush>.

 

Any ideas why?

class EdBrush
{
public:
	int m_nsides;
	EdBrushSide* m_sides;
	int m_nsharedv;
	Vec3f* m_sharedv;	//shared vertices array
	int m_texture;	//used to determine brush attributes
	EdDoor* m_door;
	
	EdBrush& operator=(const EdBrush& original);
	EdBrush(const EdBrush& original);
	EdBrush();
	~EdBrush();
	void add(EdBrushSide b);
	void setsides(int nsides, EdBrushSide* sides);
	void copysides(int* nsides, EdBrushSide** sides);
	void removeside(int i);
	void collapse();
	void remaptex();
	Vec3f traceray(Vec3f line[]);
	void prunev(bool* invalidv);
	void moveto(Vec3f newp);
};

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!