解决办法是什么..? [英] What is the solution..?

查看:95
本文介绍了解决办法是什么..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




它说应该避免动态分配内存,因为它会将内存分成小块并分配内存就效率而言,这是一个成本高昂的过程。那么什么是最好的解决方案

处理我们需要在运行时分配内存的情况。

问候

Mayank Jain(Nawal )
co *************** @ gmail.com

9818390836

解决方案

< co ***** **********@gmail.com留言

新闻:11 ********************** @ i38g2000prf.googlegr oups.com ...





它说应该避免动态分配内存,因为它将内存分成小块,并且在效率方面分配内存是一个昂贵的过程。那么什么是最好的解决方案来处理我们需要在运行时分配内存的情况。使用动态内存分配



。使用新的


8月20日晚上9:32,Jim Langston < tazmas ... @ rocketmail.comwrote:


< contactmayankj ... @ gmail.comwrote in message


新闻:11 ********************** @ i38g2000prf.googlegr oups.com ......


Hi,


它说人们应该避免动态分配内存,因为它会将内存分成
在效率方面,进入小块并分配内存是一个昂贵的过程。那么什么是最好的解决方案来处理我们需要在运行时分配内存的情况。



使用动态分配内存。使用新的



如何解决我的新问题。你是想用新的

代替malloc分配内存吗?

问候

Mayank Jain(Nawal)
共*************** @ gmail.com

9818390836


2007-08-20 18:21, co *************** @ gmail.com 写道:





它说人们应该避免动态分配内存,因为它会消耗内存在效率方面,进入小块并分配内存是一个昂贵的过程。那么什么是最好的解决方案来处理我们需要在运行时分配内存的情况。



这取决于具体情况,在所有情况下都没有完美的解决方案可以工作

。我认为建议的是,应该尽可能地优先考虑动态自动存储。但是,人们应该知道在所有情况下都不可能使用自动存储,

事实上大多数非平凡的应用程序都会使用动态内存,

直接或间接通过容器。


对于某些应用程序,某些类型的对象需要分配并经常释放池中的
-allocator可能会增加

的表现并减少碎片的影响。


-

Erik Wikstr?m


Hi,

Its said that one should avoid dynamic allocation of memory, as it de-
fragment the memory into small chunks and allocation of memory is a
costly process in terms of efficiency. So what is the best solution to
handle to situation in which we need to allocate memory at run time.
Regards
Mayank Jain(Nawal)
co***************@gmail.com
9818390836

解决方案

<co***************@gmail.comwrote in message
news:11**********************@i38g2000prf.googlegr oups.com...

Hi,

Its said that one should avoid dynamic allocation of memory, as it de-
fragment the memory into small chunks and allocation of memory is a
costly process in terms of efficiency. So what is the best solution to
handle to situation in which we need to allocate memory at run time.

using dynamic allocation of memory. use new


On Aug 20, 9:32 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:

<contactmayankj...@gmail.comwrote in message

news:11**********************@i38g2000prf.googlegr oups.com...

Hi,

Its said that one should avoid dynamic allocation of memory, as it de-
fragment the memory into small chunks and allocation of memory is a
costly process in terms of efficiency. So what is the best solution to
handle to situation in which we need to allocate memory at run time.


using dynamic allocation of memory. use new

How new is going to solve my problem. Are you trying to say use new
instead of malloc for allocating memory?
Regards
Mayank Jain(Nawal)
co***************@gmail.com
9818390836


On 2007-08-20 18:21, co***************@gmail.com wrote:

Hi,

Its said that one should avoid dynamic allocation of memory, as it de-
fragment the memory into small chunks and allocation of memory is a
costly process in terms of efficiency. So what is the best solution to
handle to situation in which we need to allocate memory at run time.

It depends on the situation, there is no perfect solution that will work
in all situations. I think that the advice is rather that one should
prefer automatic storage over dynamic when possible. However, one should
be aware that using automatic storage is not possible in all cases, in
fact most non-trivial applications will make use of dynamic memory,
either directly or indirectly via containers.

For some applications were objects of a certain kind needs to be
allocated and deallocated frequently a pool-allocator might increase the
performance and the effects of fragmentations is lessened.

--
Erik Wikstr?m


这篇关于解决办法是什么..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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