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 7948153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:38:26+00:00 2026-06-04T01:38:26+00:00

Hello I would need some help with the following code and memory leak. Error

  • 0

Hello I would need some help with the following code and memory leak.

Error log from this program shows I`m encountring the following leak in my program:

Dr. Memory version 1.4.6 build 2 built on Mar  7 2012 10:14:04
Application cmdline: ""D:\c++\Begin\L_6-8\Debug\L_6-8.exe""
Recorded 62 suppression(s) from default C:\Program Files (x86)\Dr. Memory/bin/suppress-default.txt

Error #1: UNADDRESSABLE ACCESS: reading 0x0077f5a0-0x0077f5a4 4 byte(s)
# 0 Assignment::getID()                              [..//Assignment.h:26]
# 1 AssignmentRepository::searchById()               [D:\c++\Begin\L_6-8\Debug/../AssignmentRepository.cpp:10]
# 2 AssignmentRepository::delByID()                  [D:\c++\Begin\L_6-8\Debug/../AssignmentRepository.cpp:30]
# 3 Catalog::removeAssignment()                      [D:\c++\Begin\L_6-8\Debug/../Catalog.cpp:38]
# 4 _fu63___ZSt4cout                                 [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:148]
# 5 UIconsole::runUI()                               [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:24]
# 6 Application::run()                               [D:\c++\Begin\L_6-8\Debug/../App.cpp:48]
# 7 main                                             [D:\c++\Begin\L_6-8\Debug/../App.cpp:25]
Note: @0:00:21.491 in thread 6388
Note: refers to 1 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x0077f590-0x0077f5a0
Note: instruction: mov    (%eax) -> %eax

Error #2: POSSIBLE LEAK 100 direct bytes 0x0077f5c8-0x0077f62c + 0 indirect bytes
# 0 libstdc++-6.dll!_cxa_allocate_exception
# 1 AssignmentRepository::delByID()               [D:\c++\Begin\L_6-8\Debug/../AssignmentRepository.cpp:36]
# 2 Catalog::removeAssignment()                   [D:\c++\Begin\L_6-8\Debug/../Catalog.cpp:38]
# 3 _fu63___ZSt4cout                              [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:148]
# 4 UIconsole::runUI()                            [D:\c++\Begin\L_6-8\Debug/../UIconsole.cpp:24]
# 5 Application::run()                            [D:\c++\Begin\L_6-8\Debug/../App.cpp:48]
# 6 main                                          [D:\c++\Begin\L_6-8\Debug/../App.cpp:25]

DUPLICATE ERROR COUNTS:

SUPPRESSIONS USED:

ERRORS FOUND:
      1 unique,     1 total unaddressable access(es)
      0 unique,     0 total uninitialized access(es)
      0 unique,     0 total invalid heap argument(s)
      0 unique,     0 total warning(s)
      0 unique,     0 total,      0 byte(s) of leak(s)
      1 unique,     1 total,    100 byte(s) of possible leak(s)
ERRORS IGNORED:
     89 still-reachable allocation(s)
         (re-run with "-show_reachable" for details)
Details: C:\Users\Warzaru\AppData\Roaming/Dr. Memory/DrMemory-L_6-8.exe.9752.000/results.txt

Considering my function and Repository class were did i do something wrong…

Class Header(full):

#ifndef ASSIGNMENTREPOSITORY_H_
#define ASSIGNMENTREPOSITORY_H_

#include "Assignment.h"
#include <vector>

class AssignmentRepository{
private:
    vector <Assignment> assignments;
public:
    vector <Assignment> getAll();
    void save(Assignment);
    void delByID(int);
    void editAssignment(Assignment);
    int searchById(int);
    void printAllAssignments();
    Assignment *getAssignment(int i);

    ~AssignmentRepository();
};

#endif /* ASSIGNMENTREPOSITORY_H_ 

Class cpp(part):

int AssignmentRepository::searchById(int a){
for(unsigned i=0; i<assignments.size(); i++){
    if(a == assignments[i].getID()){
        return i;
    }
}
return 0;
}

void AssignmentRepository::delByID(int i){
int check;
check = searchById(i);

if(check != 0){
    assignments.erase(assignments.begin()+check);
}
else{
    throw RepoException("ID does not exist in the database!");
}
}
  • 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-06-04T01:38:27+00:00Added an answer on June 4, 2026 at 1:38 am

    Theres some exception in this function delByID() or this removeAssignment()

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

Sidebar

Related Questions

I need some help in bison grammar construction. From my another question: I'm trying
I'm looking for some help with the following. This will be a very general
All, Need some help here. I am from a purely Java background and don't
I need some help here. I have a mysql table called dictionary like this:
Hello I would like to ask your help regarding javascript code, how do I
Thanks for all the great answers, this helps a lot! Hello, I need some
I need to convert all of the following forms into .NET Uri object: hello.world
Hello! I would like to extract all citations from a text. Additionally, the name
I need some help with a linq query. Basically, I have a datatable with
Hello I am using the following code to linkify email addresses and urls and

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.