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

The Archive Base Latest Questions

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

I use to program mainly with C/C++, that’s make me dealing with pointers and

  • 0

I use to program mainly with C/C++, that’s make me dealing with pointers and memory management daily. This days I’m trying to develop using other tools, such as Java, Python and Ruby.

The problem is that I keep thinking C++ style, I’m writing code as C++ usually written in almost every programming language, and the biggest problem is the memory management, I keep writing bad code using references in Java and just get as close as I can to the C++ style.

So I need 2 thinks here, one is to trust the garbage collector, let’s say by seeing benchmarks and proofs that it’s realy working in Java, and know what I should never do in order to get my code the best way it can be.

And the second think is knowing how to write other languages code. I mean I know what to do, I’m just never write the code as most Java or Python programmers usually do, are there any books for C++ programmers just to introduce me to the writing conventions?
(by the way, forgive me for my English mistakes)

  • 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-15T06:55:49+00:00Added an answer on May 15, 2026 at 6:55 am

    One difference to bear in mind is that in C++ the destructor can be used to clean up any kind of resource, not just memory (i.e. RAII). In Java you have to explicitly close files, sockets, datastore connections etc in a try – finally block. If you put resource cleanup code in a Java finalize method then it may get called at some indeterminate time in the future, or never, so is not recommended. So in some ways this puts a bigger burden on the programmer, not less.

    Python is somewhere in between – you can use the ‘with’ statement to handle automatic cleanup for most resources.

    The two problems in C++ memory management are memory leaks and trying to use an object that has already been destroyed. As others have pointed out you can also get memory leaks in Java (and Python) if you keep a reference to an object that you no longer need, which in turn may have references to other objects. Memory leaks in Java may be less frequent but when they do occur they can be much bigger than in C++. Judicious use of weak references can help, as well as assigning null to variables that are no longer needed. However this leads to the second problem – if you then try to use the variable you will get a NullPointerException. This is more helpful than the segmentation fault you would probably get in C++, but is still an issue.

    So all the things you learnt about memory management in C++ still apply in Java, but you have to do it for other resources too.

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

Sidebar

Ask A Question

Stats

  • Questions 434k
  • Answers 434k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This has been asked before. Quite often (example). Regexes are… May 15, 2026 at 3:15 pm
  • Editorial Team
    Editorial Team added an answer [QTMovie movieWithQuickTimeMovie:disposeWhenDone:error:] is returning an autoreleased movie. If you want… May 15, 2026 at 3:15 pm
  • Editorial Team
    Editorial Team added an answer You need to enclose the event in a class which… May 15, 2026 at 3:15 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.