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

  • Home
  • SEARCH
  • 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 8938583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:39:34+00:00 2026-06-15T10:39:34+00:00

classA objA (0, NULL); classA & objB (objA); Assuming the above to be global,

  • 0
classA objA (0, NULL);
classA & objB (objA);

Assuming the above to be global, can it result in a memory leak? Reasons?

Actually through Valgrind, I am getting an error:

5 bytes in 1 blocks are still reachable
...
global constructors keyed to classA

What does that indicate?

UPDATE:

The exact errors are here.

at 0x4C2659D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6653==    by 0x4EA7BB7: newterminal (in /usr/lib64/R/lib/libR.so)
==6653==    by 0x4EA7D4E: Rf_InitConnections (in /usr/lib64/R/lib/libR.so)
==6653==    by 0x4F420DD: setup_Rmainloop (in /usr/lib64/R/lib/libR.so)
==6653==    by 0x4FEC76A: Rf_initEmbeddedR (in /usr/lib64/R/lib/libR.so)
==6653==    by 0x5C3A8DB: RInside::initialize(int, char const* const*, bool) (in /usr/lib64/R/library/RInside/lib/libRInside.so)
==6653==    by 0x5C3AF60: RInside::RInside(int, char const* const*, bool) (in /usr/lib64/R/library/RInside/lib/libRInside.so)
==6653==    by 0x40D105: global constructors keyed to R
  • 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-15T10:39:36+00:00Added an answer on June 15, 2026 at 10:39 am

    No you never called new so you dont have to call delete.

    You should call delete only for dynamically allocated objects. Your object is not dynamically allocated, So you don’t need to. If you do so it will result in Undefined Behavior.

    Ofcourse, It is obvious and rather natural to assume that you do not have a class A constructor which leaks memory or causes undefined behavior.


    Also, note that what is considered as memory leak is open for interpretation.

    In your case the object in question is global and it is guaranteed to live throughout the lifetime of your program. Even if this object leaks memory it is a not important at all.
    This object is scheduled to be alive till the end of your program and even if it leaked memory, the duration of memory leak is destruction of this global object to the last statement in your program, after which the leaked memory will be reclaimed by the OS once your program ends.

    So, practically it does not matter whether this object leaks, ofcourse valgrind would report it as a leak but it leaks when it doesn’t matter to your program.

    The kinds of leaks you should be worried about are recurring leaks, functions or constructs which will leak memory repeatedly over the lifetime of the program. This is at best a finite leak scenario and it does not matter.

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

Sidebar

Related Questions

If I have class ObjA { public ObjB B; } class ObjB { public
I'm trying to apply the object properties from objA to objB but I realised
I have a list of ObjA and ObjB as follows: List<ObjA> List1; List<ObjB> List2;
I have a function ClassA::FuncA(const char *filePath) and want to copy this const char
I have a class ClassA that is a base class of other classes. I
I have a class ClassA mapped to TableA. I also have a mapping for
Lets say I have classA which contains classB and both are [Serializable]. I assumed,
My situation: ClassA may or may not have a parent of type ClassB .
I have three classes: ClassA , ClassB , ClassC . ClassC extends ClassB which
Class---A class ClassA { public string c1() { return Class-A; } } Class---B 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.