在内存管理方面,哪种编程语言更好? [英] Which programing language is better when it comes to memory management

查看:161
本文介绍了在内存管理方面,哪种编程语言更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在开发一个应用程序.客户希望我用Java编写代码,因为他了解Java.我非常精通C ++,并且我知道C ++在内存管理方面非常出色.如果我不能用Java编写代码,他说我可以用Python编写代码.我的python可以,但是不如我的C ++好. Python的内存管理不好,不是吗?
我只有2个月的时间来开发应用程序.您认为我是否有时间在不到2个月的时间内开发Java专业应用程序并同时学习Java. Java在内存管理方面好吗?

Hello,

There is an application i am developing. The customer wants me to code in java because he understands Java. I am very fluent in C++ and i know that C++ is very good with memory management. If i cant code in java, he said i can write the code in Python. My python is ok but, not as good as my C++. Python is not good with memory management, isn''t?
I have only 2 months to develop the application. Do you think i will have time to develop a professional application in java and learn java at the same time in less than 2 months. Is java good with memory management?

推荐答案

在Java中,您无法自己管理内存,它具有像c Sharp这样的垃圾收集器,例如"Don"就像在c ++中一样,不必担心内存泄漏",这当然意味着您将没有C所提供的灵活性和强大功能.

如果您知道c ++,Java并不是一种很难学习的语言,因为Java缺少某些功能(例如运算符重载,多重继承和没有头文件),因此您只需进行一些调整即可轻松使用Java(Java是使用c ++创建的,它们使用了完全相同的语法)

您还应该考虑的另一个问题是,您的应用程序需要使用依赖于OS的功能吗?因为Java不太擅长与操作系统进行交互. (这样做是为了使其与平台无关)

问候

K.D
In Java you don''t get to manage memory yourself it has a garbage collector like c sharp as such you "Don''t have to worry about memory leaks" as you do in c++, of course this means that you wont have the flexibility and power that C offers.

Java isn''t a hard language to learn if you know c++ Java will come easy to you with a few adjustments since certain features are missing from Java like operator overloading , multiple inheritance and no header files (Java was created with c++ they use the nearly the exact same syntax)

also another consideration you should take is that will your application need to use OS dependent features? as java isn''t very good at interacting with the OS. (this was done on purpose to make it platform independent)

Regards

K.D


对于C++是内存管理器",而不是语言.
如果您精通C++,那么学习Java(和Python)应该不是问题.
您为什么担心内存管理"有多好?这是关键问题吗?
如果不是,那么您应该看一下合适的工具来(迅速)完成工作:由于您的擅长,它可能是C++,但是考虑JavaPython可能对您有很大帮助,使您摆脱手动内存管理.
:-)
With C++, you are the ''memory manager'', not the language.
If you are fluent with C++, learning Java (and Python) shouldn''t be a problem.
Why are you worried about how good is ''memory management''? Is this a critical issue?
If it isn''t then you should look at the right tool to do (quickly) the job: it might be C++ since your good at it, but consider Java and Python could be help you a lot, relieving you from manual memory management.
:-)


基本上,这取决于您编写代码的方式.尽管CLR是.Net具有自动内存管理功能,但它也具有大量内存泄漏的可能性.例如,如果您创建了许多小的对象,这些对象被较大的对象引用了一段时间,然后超出了范围,那么垃圾收集器会将内存分块地处理.这些对象不是在第0代中收集的.但是,在以后的世代中,可能会收集这些对象,并且这些空间仍然是较大的对象块之间的空缺.而且该空间无法使用.

因此,无论高级编程平台提供什么,您都不能简单地进行虚拟编码.
Basically it depends on how you write your code. Though CLR is .Net has automatic memory management, it also has lot of memory leak potentialities. For example the garbage collector dispose the memory in chunks, if you create lot of small objects which are referenced by bigger objects for sometime and then go out of scope. These objects not collected in generation 0. But later generation it may get collected and those spaces remains as holes between larger object chunks. And that space is unusable.

So whatever the higher level programing platform offer, you can''t simply dummy coding.


这篇关于在内存管理方面,哪种编程语言更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆