Posts: 1,469
Threads: 57
Joined: Jul 2012
Thanks: 66
Given 127 thank(s) in 108 post(s)
Isn't 1GiB mem limit bad for large servers? Today's bukkit servers eat up more than 4 gigs for a mid-to large one.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
03-24-2013, 05:41 AM
(This post was last modified: 03-24-2013, 05:42 AM by xoft.)
This limit is only in the Debug version, so it doesn't influence production servers at all, it's only for when developers are hunting down those memory leaks.
With MCServer currently being compiled as 32-bit (on Windows), 2 GiB is the max memory available anyway (well, 3 GiB in special cases, but noone cares to set that up)
Posts: 91
Threads: 6
Joined: Dec 2012
Thanks: 1
Given 4 thank(s) in 3 post(s)
03-24-2013, 10:03 AM
(This post was last modified: 03-24-2013, 03:32 PM by keyboard.)
mmm it seems that I can't seem to trigger the code that detects when it goes higher than 1gb. I'm beginning to think that the issue is in the C++ libraries. I'll see if I can track those too.
EDIT:
mmm, i was able to capture a memdump by putting a try catch for bad_alloc and then dumping the memory. It made almost 1gb of xml data. Also, I made leakfinder to track the internal CRT operation to see if those are the culprit.
EDIT2:
grrr, there is no info of the function names, i suspect that it didn't write the function name because it ran out of memory
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
The problem probably is that for each allocated block another block is allocated for the stack trace, and the useful data / housekeeping data ratio is very low. So when the application allocates 300 MiB of useful data in small blocks, the housekeeping data already exhausts the available memory.
Put a breakpoint in the try catch block for bad_alloc, and when it gets hit, have a look at LeakFinder.cpp's global variable g_CurrentMemUsage. I expect it to be in the order of tens of megabytes to hundreds of megabytes. Put that number minus a few (tens of) megabytes to the condition on line 890. Feel free to commit that number into the repository, since it will make more sense than my artificial one.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
The graph has nothing out of the ordinary either. I'll have to shift my focus. Obviously there are not big blocks at play here, but rather lots and lots of small memory blocks. I'll adjust the MemDumpAnalysis tool to report the number of allocations, too.
I'll also try tweaking the LeakFinder again, I'll need you to retest something for me in, lets say, 10 minutes.
Posts: 91
Threads: 6
Joined: Dec 2012
Thanks: 1
Given 4 thank(s) in 3 post(s)
Sure, let me know when I can start testing