RFR: 8000617: It should be possible to allocate memory without	the VM dying.
    David Holmes 
    david.holmes at oracle.com
       
    Wed Oct 17 04:25:14 PDT 2012
    
    
  
On 17/10/2012 9:11 PM, Nils Loodin wrote:
>> Ummm there is tracing of the malloc calls:
>>
>> 94 void* p = os::malloc(size, F, (caller_pc != 0 ? caller_pc :
>> CALLER_PC));
>>
>> 95 if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
>
>
> That was from allocation.inline.hpp and is hidden behind an #ifdef
> ASSERT. the #elseif is
Yes but that was the file I was referring to.
>
> return os::malloc(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC)); ..
And the tracing in AllocateHeap is also guarded by #ifdef ASSERT
  50 // allocate using malloc; will fail if no memory available
   51 inline char* AllocateHeap(size_t size, MEMFLAGS flags, address pc = 0,
   52     AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
   53   if (pc == 0) {
   54     pc = CURRENT_PC;
   55   }
   56   char* p = (char*) os::malloc(size, flags, pc);
   57   #ifdef ASSERT
   58   if (PrintMallocFree) trace_heap_malloc(size, "AllocateHeap", p);
   59   #endif
PrintMallocFree in a notProduct flag.
> Also in thread.cpp there is no tracing, just an os:malloc:
And I made no comment in regard to tracing for that file.
David
-----
> return throw_excpt? AllocateHeap(size, flags, CURRENT_PC)
> - : os::malloc(size, flags, CURRENT_PC);
> + : AllocateHeap(size, flags, CURRENT_PC,
> AllocFailStrategy::RETURN_NULL);
>
> So I wouldn't say that these os::malloc calls contain tracing...
> Regards,
> Nils Loodin
    
    
More information about the hotspot-dev
mailing list