memory

SecureString for storing in memory and presenting passwords? Or something else?

强颜欢笑 提交于 2020-01-24 02:20:33
问题 I have been writing a little program for myself using C# that I can use to store my passwords and then retrieve them for viewing/editing. While the passwords are stored to disk in an encrypted format, when they are read into memory for display/editing on a form, they are unencrypted. I have learned that having unencrypted passwords in memory is a pretty big security problem, so I came across the SecureString class. Would there be a more secure way to do this than using the SecureString class,

Why difference between two pointers is not equals to size of type?

ε祈祈猫儿з 提交于 2020-01-24 01:18:08
问题 I have the simple program: #include <iostream> using namespace std; int main() { int a = 5; int b = 6; int* p1 = &a; int* p2 = &b; std::cout << p1 << " " << p2 << " ,sizeof(int)=" << sizeof(int) << std::endl; system("pause"); return 0; } It produces the following output: 00DBF9B8 00DBF9AC ,sizeof(int)=4 but, 00DBF9B8 - 00DBF9AC == С . I cannot understand this result. If I modify the program like this: #include <iostream> using namespace std; int main() { static int a = 5; static int b = 6;

Python memory error when memory is available

戏子无情 提交于 2020-01-24 00:27:08
问题 I have a Python program that reads lines of files and analyzes them. The program intentionally reads many lines into the RAM. The program started getting MemoryError while appending a line (as str) to list. When I check in the task manager (the program runs on Windows 10), I see that the memory of the program is on 1635MB (stable) and the total memory use of the machine is below 50%. I read that Python does not limit the memory, so what could be the reason? Technical details: I use Python 3.6

need to write shared memory allocator for c++ std::vector

心已入冬 提交于 2020-01-24 00:22:06
问题 Please help to write c++ allocator for std::vector< nIcon*> class. All examples i find shows just what methods i need to overwrite, not code examples. I need to implement allocator using shared memory on windows (using CreateFileMapping and MapViewOfFile) 回答1: May I suggest you look at the boost interprocess library? It allows you to create allocators using shared memory. I've seen some examples around, I would say just look a bit more. I agree that none of them do a perfect job, thus I won't

Memory not released when popViewController Called

亡梦爱人 提交于 2020-01-23 17:37:08
问题 Below is the code in which i have some doubts:- MyController *vc= [MyViewController alloc] initWithNibName:@"myController" bundle:nil]; [self.navigationController pushViewController:vc animated:YES]; [vc release]; Then, i pop my controller by pressing the back button on nav bar. The problem is memory is increased by 5mb(On Activity Monitor) for the first time.And when i pop the controller it doesnt get released. And when i do the push and pop again and again the memory increases by small

What are “undetectable means” and how can they change objects of a C/C++ program?

China☆狼群 提交于 2020-01-23 17:28:45
问题 In ISO/IEC 14882:2003 (C++03) is stated under 7.1.5.1/8, section "The cv-qualifers": [Note: volatile is a hint to the implementation to avoid aggressive optimization involving the object because the value of the object might be changed by means undetectable by an implementation. See 1.9 for detailed semantics. In general, the semantics of volatile are intended to be the same in C++ as they are in C. ] These "means", that are undetectable by an implementation has been also already subject of

What are “undetectable means” and how can they change objects of a C/C++ program?

给你一囗甜甜゛ 提交于 2020-01-23 17:28:28
问题 In ISO/IEC 14882:2003 (C++03) is stated under 7.1.5.1/8, section "The cv-qualifers": [Note: volatile is a hint to the implementation to avoid aggressive optimization involving the object because the value of the object might be changed by means undetectable by an implementation. See 1.9 for detailed semantics. In general, the semantics of volatile are intended to be the same in C++ as they are in C. ] These "means", that are undetectable by an implementation has been also already subject of

2D cache-friendly data structures and space-filling curves

╄→гoц情女王★ 提交于 2020-01-23 16:45:48
问题 I've read that space-filling curves such as the Peano curve are useful for maintaining cache-friendly data structures in a linear address space, since they maintain physical spatial locality. However, I'm not sure how to actually use them. Do any of these curves have formulas for quickly translating a linear address into (x,y) coordinates and vice-versa? Otherwise, how do I determine where in memory to look when looking up a certain pair of coordinates? An example would be very helpful. 回答1:

Where is the captured variables allocated in nested function in C#

微笑、不失礼 提交于 2020-01-23 16:40:49
问题 The nested function mentioned means it could be both lambda function and local function. I am curious about where the captured variables are allocated. For Example: private Func<int> Test(int arg) { var x = arg; return () => x; } The local variable x is captured by the lambda function returned. Then where is this x allocated in memory? Is it on stack or heap memory? If this x is on stack, any further call on Test could change the value of x and the behavior of the lambda function returned

How to analyze Heap Dumps

那年仲夏 提交于 2020-01-23 15:01:46
问题 I am successful in generating Heap Dumps of my application machine but I do not know how to analyze it. Can someone tell me how to? 回答1: Use jhat utility for Java on Sun solaris. A good example is here https://blogs.oracle.com/alanb/entry/heap_dumps_are_back_with 回答2: You can try VisialVM, for some reason my heap dump wasn't loading in jhat but was in visualVM. It give you a graph of the class that are taking much of the heap. here where to get it: http://visualvm.java.net/download.html 来源: