Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 909699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:55:26+00:00 2026-05-15T16:55:26+00:00

I have a class here that is defined like this: struct USERFPOINT { POINTFLOAT

  • 0

I have a class here that is defined like this:

struct USERFPOINT
{
    POINTFLOAT UserPoint;
    POINTFLOAT LeftHandle;
    POINTFLOAT RightHandle;
    bool isBezier;
};

struct SHAPEOUTLINE {
    GLuint OutlineVBO;
    int OutlineSize;
    int OutlineWidth;
    ARGBCOLORF OutlineColor;
};

struct SHAPECONTOUR{

    std::vector<USERFPOINT> UserPoints;
    std::vector<std::vector<GLdouble>> DrawingPoints;
    SHAPEOUTLINE Outline;

};
struct SHAPEGRADIENT{
    GLuint TextureId;
    bool IsParent;
    bool active;
    int type;
    std::vector<ARGBCOLORF> colors;
};

struct SHAPEDIMENSIONS {
    POINTFLOAT Dimensions;
    POINTFLOAT minima;
    POINTFLOAT maxima;
};

class OGLSHAPE
{
private:
    int WindingRule;
    GLuint TextureCoordsVBOInt;
    GLuint ObjectVBOInt;
    UINT ObjectVBOCount;
    UINT TextureCoordsVBOCount;
    SHAPEGRADIENT Gradient;
    SHAPEDIMENSIONS Dimensions;
    void SetCubicBezier(USERFPOINT &a,USERFPOINT &b, int &currentcontour);

    void GenerateLinePoly(const std::vector<std::vector<GLdouble> > &input, int width);
public:
    std::string Name;
    ARGBCOLORF MainShapeColor;
    std::vector<SHAPECONTOUR> Contour;
    OGLSHAPE(void);

    void UpdateShape();
    void SetMainColor(float r, float g, float b, float a);
    void SetOutlineColor( float r, float g, float b, float a,int contour );
    void SetWindingRule(int rule);
    void Render();
    void Init();
    void DeInit();
    ~OGLSHAPE(void);
};

Here is what I did as a test. I created a global std::vector<OGLSHAPE> test .

In the function I was using, I created

OGLSHAPE t.

I then pushed 50,000 copies of t into test.

I then instantly cleared test and used the swap trick to really deallocate it.

I noticed that all the memory was properly freed as I would expect.

I then did the same thing but before pushing t into test, I pushed a SHAPECONTOUR (which I had just created without modifying or adding anything into the contour) before pushing t into test.

This time after clearing test, 3 more megabytes had been allocated. I did it again allocating twice as many and now 6MB we remaining. The memory usage of the program peaked at 150MB and it went down to 12MB, but it should be at 8.5MB. Therefore, this must be classified as a memory leak, although I do not see how. There is nothing that I see that could do that. SHAPECONTOUR is merely a structure of vectors with a nested structure of vectors.

Why would this cause a leak, and how could I fix it?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:55:27+00:00Added an answer on May 15, 2026 at 4:55 pm

    If you’ve deleted everything, there is no leak, by definition. I don’t see any unwrapped pointers, ergo everything gets deleted. Therefore, you have no leaks.

    Likely, the OS has simply decided to leave that memory available to your program, for whatever reason. (It hasn’t “reclaimed” it.) Or maybe it needs to allocate in groups of4MB, and so going from 12MB to 8MB wouldn’t leave enough required memory. Or…

    You’re cutting out other reasons entirely; you should use a real memory leak tool to find memory leaks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the scenario: I'd like to have a host class that can have a
I have a class that looks like this: class SearchService include Mongoid::Document key :name,
I have a collapsible menu item that is defined in XML like this: <item
My motivation for chaining my class constructors here is so that I have a
I have a class that basically stores files in amazon s3. Here is what
Here's what I am looking to accomplish, I have a class that has an
Here is my custom class that I have that represents a triangle. I'm trying
i'm missing something fundamental here. i have a very simple custom class that draws
I have this class called SiteAsyncDownload.cs Here's the code: public class SiteAsyncDownloader { WebClient
I have such class (sorry about posible mistakes, i'm writing it right here.) Class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.