Project

General

Profile

Actions

Bug #11459

closed

Ruby leaks several MB of memory every setup/eval/cleanup cycle.

Added by scorpion007 (Alex Budovski) about 9 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
latest master
[ruby-core:<unknown>]

Description

Even with a trivial eval "1" Ruby leaks about 2 MB or so after ruby_cleanup.

I've attached the raw list of leaks as reported by the CRT (I took a snapshot before ruby_setup and again after ruby_cleanup).

I've also attacked a few sample callstacks of the leaks (I picked 5 or so randomly).

Isn't ruby_cleanup supposed to clean something up?


Files

rubyleaks.txt (1.47 MB) rubyleaks.txt scorpion007 (Alex Budovski), 08/19/2015 12:55 AM
ruby_leak_stacks.txt (8.4 KB) ruby_leak_stacks.txt scorpion007 (Alex Budovski), 08/19/2015 01:00 AM
Actions #1

Updated by scorpion007 (Alex Budovski) about 9 years ago

Here's another big leak: This stack leaks nearly 1MB (~780K). When is Init_heap supposed to be undone?

+  787080 ( 787080 -      0)     24 allocs	BackTrace9BD000CB
+      24 (     24 -      0)	BackTrace9BD000CB	allocations

	ntdll!RtlpCallInterceptRoutine+40 (d:\blue\minkernel\ntos\rtl\heappriv.h, 3625)
	ntdll!RtlAllocateHeap+79836 (d:\blue\minkernel\ntos\rtl\heap.c, 1892)
	MSVCR120D!_heap_alloc_base+5D (f:\dd\vctools\crt\crtw32\heap\malloc.c, 58)
	MSVCR120D!_heap_alloc_dbg_impl+27B (f:\dd\vctools\crt\crtw32\misc\dbgheap.c, 431)
	MSVCR120D!_nh_malloc_dbg_impl+39 (f:\dd\vctools\crt\crtw32\misc\dbgheap.c, 239)
	MSVCR120D!_nh_malloc_dbg+49 (f:\dd\vctools\crt\crtw32\misc\dbgheap.c, 302)
	MSVCR120D!_malloc_dbg+39 (f:\dd\vctools\crt\crtw32\misc\dbgheap.c, 160)
	MSVCR120D!_aligned_offset_malloc_dbg+245 (f:\dd\vctools\crt\crtw32\misc\dbgheap.c, 2891)
	MSVCR120D!_aligned_malloc+2B (f:\dd\vctools\crt\crtw32\misc\dbgheap.c, 2622)
	rubyprov!aligned_malloc+1E (e:\dev\ruby\gc.c, 7393)
	rubyprov!heap_page_allocate+2C (e:\dev\ruby\gc.c, 1445)
	rubyprov!heap_page_create+36 (e:\dev\ruby\gc.c, 1531)
	rubyprov!heap_assign_page+18 (e:\dev\ruby\gc.c, 1553)
	rubyprov!heap_add_pages+61 (e:\dev\ruby\gc.c, 1567)
	rubyprov!Init_heap+5E (e:\dev\ruby\gc.c, 2187)
	rubyprov!ruby_setup+47 (e:\dev\ruby\eval.c, 57)

Updated by jeremyevans0 (Jeremy Evans) about 5 years ago

  • Status changed from Open to Closed

ruby_cleanup should only be called once per process, before exiting (either via main->ruby_run_node or ruby_stop). It is not expected to free all memory allocated earlier, since the process will be exiting and the operating system should free the remaining memory.

Actions

Also available in: Atom PDF

Like0
Like0Like0