@@ -45,6 +45,7 @@ def initialize(interface)
4545 end
4646
4747 def print_msg ( *args )
48+ puts 'def print_msg(*args)'
4849 msg , *args = args
4950 xml_message = CGI . escapeHTML ( msg % args )
5051 print "<message>#{ xml_message } </message>"
@@ -384,7 +385,7 @@ def max_compact_name_size
384385 50
385386 end
386387
387- def inspect_with_allocation_control ( slice , memory_limit )
388+ def inspect_with_allocation_control ( slice , memory_limit , obj_id )
388389 curr_thread = Thread . current
389390
390391 start_alloc_size = ObjectSpace . memsize_of_all
@@ -395,7 +396,7 @@ def inspect_with_allocation_control(slice, memory_limit)
395396 if ( curr_alloc_size - start_alloc_size > 1e6 * memory_limit )
396397
397398 trace . disable
398- curr_thread . raise MemoryLimitError , "Out of memory: evaluation took longer than #{ memory_limit } mb." if curr_thread . alive?
399+ curr_thread . raise MemoryLimitError , "Out of memory: evaluation of inspect for obj( #{ obj_id } ) took more than #{ memory_limit } mb." if curr_thread . alive?
399400 end
400401 end
401402
@@ -404,6 +405,7 @@ def inspect_with_allocation_control(slice, memory_limit)
404405 trace . disable
405406 result
406407 rescue MemoryLimitError => e
408+ print_msg ( e . message )
407409 return nil
408410 end
409411
@@ -413,7 +415,7 @@ def compact_array_str(value)
413415 compact = if ( defined? ( JRUBY_VERSION ) || ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i <= 0 )
414416 slice . inspect
415417 else
416- compact = inspect_with_allocation_control ( slice , ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i )
418+ compact = inspect_with_allocation_control ( slice , ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i , value . object_id . to_s )
417419 end
418420
419421 if compact && value . size != slice . size
0 commit comments