memory

直接内存(Direct Memory)牛刀小试

[亡魂溺海] 提交于 2020-01-28 04:56:51
Direct Memory 特点 常见于NIO操作时,用于数据缓存 分配回收成本较高,但是读写性能高 不受JVM内存回收管理 案例说明 为了做对比,还是直接写一段程序测试: import java . io . File ; import java . io . FileInputStream ; import java . io . FileOutputStream ; import java . io . IOException ; import java . nio . ByteBuffer ; import java . nio . channels . FileChannel ; /** * 直接内存的读写测试 */ public class Jvm1_9 { static final String fromFile = "/tmp/12GB.dat" ; static final String toFile = "/tmp/12GB_new.dat" ; //mkfile -n 12g /tmp/12GB.dat static final int _256M = 256 * 1024 * 1024 ; public static void main ( String [ ] args ) { io ( ) ; directBuffer ( ) ; } public

[转] 从free到 page cache

安稳与你 提交于 2020-01-27 19:17:48
[转自 https://www.cnblogs.com/hustcat/archive/2011/10/27/2226995.html ] Free 我们经常用 free 查看服务器的内存使用情况,而 free 中的输出却有些让人困惑,如下: 图 1-1 先看看各个数字的意义以及如何计算得到: free命令输出的第二行(Mem):这行分别显示了物理内存的总量(total)、已使用的 (used)、空闲的(free)、共享的(shared)、buffer(buffer大小)、 cache(cache的大小)的内存。我们知道Total、free、buffers、cached这几个字段是从/proc/meminfo中获取的,而used = total – free。Share列已经过时,忽略(见参考)。 free命令输出的第三行(-/+ buffers/cache): 它显示的第一个值(used):548840,这个值表示系统本身使用的内存总量,即除去buffer/cache,等于Mem行used列 - Mem行buffers列 - Mem行cached列。 它显示的第二个值(free):1417380,这个值表示系统当前可用内存,它等于Mem行total列—used,也等于Mem行free列 + Mem行buffers列 + Mem行cached列。 free命令输出的第四行(Swap

v4l2的学习建议和流程解析

给你一囗甜甜゛ 提交于 2020-01-27 19:06:43
  v4l2,一开始听到这个名词的时候,以为又是一个很难很难的模块,涉及到视频的处理,后来在网上各种找资料后,才发现其实v4l2已经分装好了驱动程序,只要我们根据需要调用相应的接口和函数,从而实现视频的获取和处理。只要认真的看几篇文章就对v4l2有一定的了解了,由于是第一次接触,网上的资料良莠不齐,难得可以找到几篇自己感觉很不错的。记录下来:(没必要看太多,很多都是一样的意思) http://www.embedu.org/Column/Column320.htm 这篇是不错的介绍,很讨厌有弹窗 http://www.cnblogs.com/emouse/archive/2013/03/04/2943243.html 这个可以作为第一篇来看,博主整理的不错 http://blog.chinaunix.net/uid-11765716-id-2855735.html 这篇也比较详细 http://blog.csdn.net/ddddwant/article/details/8475211 这篇提到的问题和我遇到的一样,花屏了,内存没有读取好 http://my.oschina.net/u/1024767/blog/210801#OSC_h2_14 对capture.c文件的解读 http://blog.csdn.net/g_salamander/article/details

Sequential access memory(SAM) and (RAM), Flash memory

我的未来我决定 提交于 2020-01-27 06:04:54
In computing, sequential access memory ( SAM ) is a class of data storage devices that read their data in sequence. This is in contrast to random access memory (RAM) where data can be accessed in any order. Sequential access devices are usually a form of magnetic memory . While sequential access memory is read in sequence, accesses can still be made to arbitrary locations by "seeking" to the requested location. This operation, however, is often relatively inefficient (see seek time , rotational latency ). Magnetic sequential access memory is typically used for secondary storage in general

IIS“页面无法显示”的故障及其解决方法

半城伤御伤魂 提交于 2020-01-27 04:56:25
1、 运行环境 服务器操作系统:Microsoft Windows Server 2003 Enterprise Edition Service Pack 1 服务器IIS:6.0 客户端:IE5.5+ 2、故障现象: 客户端无法访问Web服务器,错误信息是"页面无法显示",服务器上检查IIS时未发现停止运行,但就是无法访问(即使是静态页面)。查阅windows 安装目录下的system32\LogFiles\HTTPERR\httperrXXX.log(XXX表示数字)文件,发现多条日志都报 Number_Connections_Refused错误(Number是一个整数如1、2、3等)。重启IIS无法解决问题,都是通过重启电脑解决。 3、网上搜索结果: 经搜索,原因可能是nonpaged pool memory(非分页池内存)不够。搜索到以下文档: 微软的官方文档:http://support.microsoft.com/kb/934878/en 一个诊断具体原因的方法:http://jackyhawk.blog.hexun.com/9608276_d.html ,该方法使用了安装盘内Support.cab里面的Poolmon.exe,可直接将Support.cab里面的Poolmon.exe解压出来执行 Poolmon的使用说明:http://support

MemoryCache类使用记录

让人想犯罪 __ 提交于 2020-01-27 03:53:10
NuGet引用Microsoft.Extensions.Caching.Memory包 引用命名空间 using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; 实例化之后就可以使用. static void Main(string[] args) {   var cache = new MemoryCache(new MemoryCacheOptions());  //设置静态缓存   cache.Set("A", 1);  if (cache.TryGetValue("User", out int value))    Console.WriteLine(value); //设置一秒后过期   cache.Set("B",2,DateTimeOffset.Now.AddMilliseconds(1000).DateTime);  Console.ReadLine(); } 有两点需要注意. 1.取出缓存的时候取出的是实例引用.修改该实例会影响缓存内的实例. 2.在Standard类库中引用Microsoft.Extensions.Caching.Memory包(版本:3.1.1)时,依赖的System.Memory版本为4.5.2.会与其他包或者SDK依赖的System

CF712E Memory and Casinos

自闭症网瘾萝莉.ら 提交于 2020-01-26 20:13:03
Link 设 \(f(l,r)\) 为从 \(l\) 走到 \(r+1\) 并且在 \(l,r\) 没有输过的概率, \(g(l,r)\) 为从 \(r\) 走到 \(l-1\) 并且在 \(l,r\) 没有赢过的概率。 那么这题看上去就很线段树了对吧。 首先很显然 \(f(i,i)=p_i,g(i,i)=1-p_i\) 。 然后考虑合并 \([l,mid],(mid,r]\) 的答案。 枚举跨过 \((mid,mid+1)\) 这一分界线然后又走回来的次数,可以得到 \(f(l,r)=f(l,mid)f(mid+1,r)\sum\limits_i((1-f(mid+1,r))(1-g(l,mid)))^i\) 。 显然这个幂级数收敛,所以 \(f(l,r)=\frac{f(l,mid)f(mid+1,r)}{1-(1-f(mid+1,r))(1-g(l,mid))}\) 。 同理可得 \(g(l,r)=\frac{g(l,mid)g(mid+1,r)}{1-(1-f(mid+1,r))(1-g(l,mid))}\) 。 然后线段树随便维护一下就完事了。 #include<cstdio> #include<cctype> namespace IO { char ibuf[(1<<21)+1],*iS,*iT; char Get(){return (iS==iT? (iT=(iS

iOS6 MKMapView using a ton of memory, to the point of crashing the app, anyone else notice this?

十年热恋 提交于 2020-01-26 09:38:45
问题 Has anyone else, who's using maps in their iOS 6 apps, noticing extremely high memory use to the point of receiving memory warnings over and over to the point of crashing the app? I've ran the app through instruments and I'm not seeing any leaks and until the map view is created the app consistently runs at around ~3mb Live Bytes. Once the map is created and the tiles are downloaded the Live Bytes jumps up to ~13mb Live Bytes. Then as I move the map around and zoom in and out the Live Bytes

第3章 Python垃圾回收

只愿长相守 提交于 2020-01-26 05:40:26
Python 垃圾回收机制 计数引用, Python 中一切皆对象。因此,你所看到的一切变量,本质上都是对象的一个指针,计数引用就是这个指针。 那么,怎么知道一个对象,是否永远都不能被调用了呢? 就是当这个对象的引用计数(指针数)为 0 的时候,说明这个对象永不可达,自然它也就成为了垃圾,需要被回收。 import os import psutil 1、显示当前 python 程序占用的内存大小 import os import psutil #显示当前 python 程序占用的内存大小 def show_memory_info(hint): pid = os.getpid() p = psutil.Process(pid) info = p.memory_full_info() memory = info.uss /1024 /1024 print('{} memory used:{}MB'.format(hint,memory)) def func(): show_memory_info('initia') #global a #局部变量,但函数调用结束,a会被释放,所占用内存会被释放 a = [i for i in range(10000000)] show_memory_info('after a created') func() show_memory_info(

Big graph in memory

你。 提交于 2020-01-26 04:33:09
问题 I want to record all used ports within huge pcaps. There are 65535 ports available, and each port is able to talk each other port: 65535 x 65535 links in total The matrix will be very sparse (many 0 entries). Additionally, I think the edges don't have to be directed, so Port1->Port2 may be added to Port2->Port1 (which reduces our amount of values to 65535 * 65536 / 2). How would you store this using python? In numpy? What will be the estimated amount of memory consumption for this? Afterwards