heap

What do the 'size' numbers mean in the windbg !heap output?

…衆ロ難τιáo~ 提交于 2019-12-12 21:23:13
问题 I see output like this in my DMP file: Heap entries for Segment00 in Heap 00150000 00150640: 00640 . 00040 [01] - busy (40) 00150680: 00040 . 01808 [01] - busy (1800) 00151e88: 01808 . 00210 [01] - busy (208) 00152098: 00210 . 00228 [00] 001522c0: 00228 . 00030 [01] - busy (22) 001522f0: 00030 . 00018 [01] - busy (10) 00152308: 00018 . 00048 [01] - busy (3c) The WinDbg docs say this: Heap entries for Segment00 in Heap 250000 0x01 - HEAP_ENTRY_BUSY 0x02 - HEAP_ENTRY_EXTRA_PRESENT 0x04 - HEAP

c++, object created on the heap vs. local - when returning a pointer

我只是一个虾纸丫 提交于 2019-12-12 18:23:43
问题 This is a follow up question from Safe in C# not in C++, simple return of pointer / reference, Is this: person* NewPerson(void) { person p; /* ... */ return &p; //return pointer to person. } the same as? person* NewPerson(void) { person* pp = new person; return pp; //return pointer to person. } I know that the first one is a bad idea, because it will be a wild pointer. In the second case, will the object be safe on the heap - and like in c# go out of scope when the last reference is gone to

out of memory when converting a large stream to string

旧街凉风 提交于 2019-12-12 16:26:37
问题 I am trying to convert a large stream (4mb) to a string which i eventually convert it to a JSON Array. when the stream size is small ( in KB ) every thing works fine, the minute it starts to process the 4mb stream it runs out of memory below is what i use use to convert the stream to string, I've tried almost every thing and i suspect the issue is with the while loop. can some one please help? public String convertStreamToString(InputStream is) throws IOException { if (is != null) { Writer

Calling delete on variable allocated on the stack

狂风中的少年 提交于 2019-12-12 16:12:27
问题 Ignoring programming style and design, is it "safe" to call delete on a variable allocated on the stack? For example: int nAmount; delete &nAmount; or class sample { public: sample(); ~sample() { delete &nAmount;} int nAmount; } 回答1: No, it is not safe to call delete on a stack-allocated variable. You should only call delete on things created by new . For each malloc or calloc , there should be exactly one free . For each new there should be exactly one delete . For each new[] there should be

Heap size in C# / .Net Framework - Can it grow and how? [duplicate]

假装没事ソ 提交于 2019-12-12 16:01:19
问题 This question already has answers here : Can I (and do I ever want to) set the maximum heap size in .net? (4 answers) Closed 8 months ago . I've encounterd a confusing matter written in one of my college books: It is stated there that "The heap is not static and can grow as needed by requesting more memory from the operating system". So what I'm confused about is the following: Suppose I run my application, and objects are allocated on the heap. At some point, the application runs out of

java.lang.OutOfMemoryError: GC overhead limit exceeded

本秂侑毒 提交于 2019-12-12 14:12:18
问题 In R Studio using R, when trying to join 2 tables which have about 100k records(DB2 DB) , getting below error and none of the google solutions worked. Error 'in .jcall(x, "S", "getMessage")': java.lang.OutOfMemoryError: GC overhead limit exceeded 回答1: if you are using intillij On the main menu, choose File. Invalidate Caches/Restart 回答2: I had this problem several times, sometimes randomly. What helped me so far was using the following command at the beginning of the script before loading any

Why does heap space constantly increase when monitoring Tomcat with Java VisualVM?

断了今生、忘了曾经 提交于 2019-12-12 13:24:14
问题 I have a JRubyOnRails application running in Tomcat. After browsing to my application (localhost), logging in and then doing nothing, the Heap space seems to be growing continuously... Is that normal? If I press on Perform GC, it does go down again. I'm wondering what will happen if I just leave it until it reaches the maximum of my Computer RAM? And why is it increasing all the time while nothing happens? Is it due to the fact that I'm monitoring my application? 来源: https://stackoverflow.com

How big is a heap frame in Visual C++

北城以北 提交于 2019-12-12 11:28:36
问题 In Visual C++, if I use new to create an object on the heap, how much extra space is taken for the heap frame header and padding, specifically in release code? I'd expect an int to say how much space was available in the block, and another perhaps to say how much of that space was currently in use, and that frame sizes are rounded to the nearest 32 or 64 bits based on architecture. Just wondering does VC++ add anything extra like guard bytes, flags, etc... and are frame sizes rounded to a

Scala ordered priority queue that always has the lowest number as the head, ascending order

若如初见. 提交于 2019-12-12 10:58:00
问题 I'd like to get a code sample that accomplishes ascending ordering of items in a priority queue. I'd like to store Tuple2(Int, String) inside a priority queue so that it is ordered by the first element of the tuple in ascending order. If my priority queue is called pq and I call pq.head I'd like to get the tuple with the lowest number, same thing with calling pq.dequeue . scala> val pq = scala.collection.mutable.PriorityQueue[(Int, String)]() pq: scala.collection.mutable.PriorityQueue[(Int,

Complexity of finding the median using 2 heaps

ぃ、小莉子 提交于 2019-12-12 09:49:59
问题 A way of finding the median of a given set of n numbers is to distribute them among 2 heaps. 1 is a max-heap containing the lower n/2 (ceil(n/2)) numbers and a min-heap containing the rest. If maintained in this way the median is the max of the first heap (along with the min of the second heap if n is even). Here's my c++ code that does this: priority_queue<int, vector<int> > left; priority_queue<int,vector<int>, greater<int> > right; cin>>n; //n= number of items for (int i=0;i<n;i++) { cin>