memory

how to cache 1000s of large C++ objects

十年热恋 提交于 2020-01-05 13:09:02
问题 Environment: Windows 8 64 bit, Windows 2008 server 64 bit Visual Studio (professional) 2012 64 bits list L; //I have 1000s of large CMyObject in my program that I cache, which is shared by different threads in my windows service program. For our SaaS middleware product, we cache in memory 1000s of large C++ objects (read only const objects, each about 4MB in size), which runs the system out of memory. Can we associate a disk file (or some other persistent mechanism that is OS managed) to our

Failsafe Allocation

醉酒当歌 提交于 2020-01-05 12:16:18
问题 I am working on windows XP. So I understand that auto variables are stored on the stack and the dynamically generated data of the pointer variables are stored on the heap. Is the amount of stack memory and heap memory available to each program fixed. Can it be set different for a particular program? If yes then -> Is the setting done automatically by the system or does it have to be done manually in some way? I am planning to create a huge array(say 50000 records) of a structure in C. I can

Unsigned narrow character type number representation

北城余情 提交于 2020-01-05 12:16:09
问题 N3797::3.9.1/1 [basic.fundamental] says For unsigned narrow character types, all possible bit patterns of the value representation represent numbers. That's a bit unclear for me. We have the following ranges for narrow character types: unsigned char := 0 -- 255 signed char : = -128 -- 127 For both unsgined char and signed char objects we have one-to-one mapping from the set of bits in these object representation to the integral value they could represent. The Standard says N3797::3.9.1/1

ios view controllers keep staking in memory

杀马特。学长 韩版系。学妹 提交于 2020-01-05 12:14:10
问题 I am new to Objective C. I am working on my first app. - It basically consists of 2 view controllers, and I use modal segue to switch between them. The main vc is a menu that loads up the 2nd vc with different attributes for each menu item. - I noticed that the memory keeps increasing when I switch from one vc to the other. This was my attempt to solve the issue but it doesn't make a difference and it doesn't look clean. -(void)viewDidDisappear:(BOOL)animated{ ViewController *me = self; me =

Receiving java.sql.SQLException: out of memory

随声附和 提交于 2020-01-05 12:13:54
问题 I got this error message in NetBeans 6.8: Exception in thread "main" java.sql.SQLException: out of memory at org.sqlite.DB.throwex(DB.java:288) at org.sqlite.NativeDB._open(Native Method) at org.sqlite.DB.open(DB.java:77) at org.sqlite.Conn.<init>(Conn.java:88) at org.sqlite.JDBC.connect(JDBC.java:64) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:207) I changed my VM options but am still receiving the error. How can

Receiving java.sql.SQLException: out of memory

瘦欲@ 提交于 2020-01-05 12:13:06
问题 I got this error message in NetBeans 6.8: Exception in thread "main" java.sql.SQLException: out of memory at org.sqlite.DB.throwex(DB.java:288) at org.sqlite.NativeDB._open(Native Method) at org.sqlite.DB.open(DB.java:77) at org.sqlite.Conn.<init>(Conn.java:88) at org.sqlite.JDBC.connect(JDBC.java:64) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:207) I changed my VM options but am still receiving the error. How can

Assessing how large a file (How much RAM it will take) will be in R before loading it

前提是你 提交于 2020-01-05 09:10:05
问题 I was wondering if there's some function that given a file name + path can asses how much RAM R will need to use it? i want to be able to know this info before I'm loading it. 回答1: You can use 'fstat' http://linux.die.net/man/2/fstat It will report information about your file, such as actual filesize. struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ mode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /*

Assessing how large a file (How much RAM it will take) will be in R before loading it

£可爱£侵袭症+ 提交于 2020-01-05 09:08:54
问题 I was wondering if there's some function that given a file name + path can asses how much RAM R will need to use it? i want to be able to know this info before I'm loading it. 回答1: You can use 'fstat' http://linux.die.net/man/2/fstat It will report information about your file, such as actual filesize. struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ mode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /*

Understanding memory used by a program in bash (in ubuntu linux)

余生颓废 提交于 2020-01-05 09:01:35
问题 In some programming contests, problems have a memory limit (like 64MB or 256MB). How can I understand the memory used by my program (written in C++) with bash commands? Is there any way to limit the memory used by the program? The program should terminate if it uses more memory than the limit. 回答1: The command top will give you a list of all running processes and the current memory and swap or if you prefer the GUI you can use the System Monitor Application. As for locking down memory usage

Large amounts of memory allocated on setImage:

孤街浪徒 提交于 2020-01-05 08:54:48
问题 I have a UIImageView that was created programmatically ( [[UIImageView alloc] init] ). The app's memory stays in check until the setImage: method is called. Any thoughts? 回答1: I'm assuming you're setting your image to your image view using something like this: [imgV setImage:[UIImage imageNamed:@"yourImg.png"]] The problem with using that is that the app caches these images. If you'd like to avoid caching images, use imageWithContentsOfFile: : [imgV setImage:[UIImage imageWithContentsOfFile:[