memory-profiler 1.1.14 → 1.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c26d5bc8b4215de3776e42ec9cd8daaf54a3cba9d55449f6b570ba7ee5ef9c91
4
- data.tar.gz: 6668320402b35e3633eff016bd79b34c6b69952cb03120fc7f04886782bacfe3
3
+ metadata.gz: cce184966c5eb2b104059f419fb7f220b2bea168b5359adacc90923079332241
4
+ data.tar.gz: 436690f9e75f5ba72546604fd58d71efccb56d4dc8b8880feaa3b4ecab03c918
5
5
  SHA512:
6
- metadata.gz: 68404ae44a442584084727cc854ed81abc36964c5621b93361cde70c6ae80f71ad21c7a45caf049c5906846cec8dff23ccbddb2e021eedf137e8ba7d57c78363
7
- data.tar.gz: 406d8caac175e30907d752cec211d066a8c7ed5bf260c4e4eba6304f73b60d7c47be6d68d8b6cc4e738cb8fe19ebadeea0f251c7b2df888923b86abdaae2867e
6
+ metadata.gz: 54d4d1e2f8d19da788e53ffa0c5e69dcaf5db708d5d1de0336bccc79c6311330a56b0c8cb605b7bb7dbc116b91b91a752cacf317d4403e5188517ddcdded12a2
7
+ data.tar.gz: 4994f81f0b6dd2b0c46bc3aa3e415dbc16ffb633d9fefdeafd67d10df522aaccc5003dd632a664b8eb69e476053bac5f51d0979c69c4daa97965356b1bb2ca9c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -298,21 +298,6 @@ static void Memory_Profiler_Capture_event_callback(VALUE data, void *ptr) {
298
298
  VALUE klass = rb_class_of(object);
299
299
  if (!klass) return;
300
300
 
301
- // Check if class is already freed (T_NONE). This can happen when:
302
- // 1. Object was allocated before capture started (no NEWOBJ event queued).
303
- // 2. Anonymous class (Class.new) was freed before its instances.
304
- //
305
- // If the class is T_NONE, it means:
306
- // - It's NOT in tracked_classes (would retain it via GC mark callback).
307
- // - It's NOT in any pending NEWOBJ event (would retain it via event queue marking).
308
- //
309
- // Therefore process_freeobj() would skip this event anyway (class lookup fails at line 200).
310
- // We must skip enqueueing to avoid attempting to mark a T_NONE object during GC,
311
- // which can cause: [BUG] try to mark T_NONE object.
312
- if (rb_type(klass) == T_NONE) {
313
- return;
314
- }
315
-
316
301
  if (DEBUG) {
317
302
  const char *klass_name = "(ignored)";
318
303
  if (event_flag == RUBY_INTERNAL_EVENT_NEWOBJ) {
@@ -325,6 +310,7 @@ static void Memory_Profiler_Capture_event_callback(VALUE data, void *ptr) {
325
310
  // Skip NEWOBJ if disabled (during callback) to prevent infinite recursion
326
311
  if (capture->paused) return;
327
312
 
313
+ // Check if class is already freed (T_NONE). This can happen when:
328
314
  // It's safe to unconditionally call here:
329
315
  object = rb_obj_id(object);
330
316
 
@@ -332,6 +318,10 @@ static void Memory_Profiler_Capture_event_callback(VALUE data, void *ptr) {
332
318
  } else if (event_flag == RUBY_INTERNAL_EVENT_FREEOBJ) {
333
319
  // We only care about objects that have been seen before (i.e. have an object ID):
334
320
  if (RB_FL_TEST(object, FL_SEEN_OBJ_ID)) {
321
+ // For freeobj, we only care about klasses that we are tracking.
322
+ // This prevents us from enqueuing klass objects that might be freed.
323
+ if (!st_lookup(capture->tracked_classes, (st_data_t)klass, NULL)) return;
324
+
335
325
  // It's only safe to call here if the object already has an object ID.
336
326
  object = rb_obj_id(object);
337
327
 
@@ -7,7 +7,7 @@
7
7
  module Memory
8
8
  # @namespace
9
9
  module Profiler
10
- VERSION = "1.1.14"
10
+ VERSION = "1.1.15"
11
11
  end
12
12
  end
13
13
 
data/readme.md CHANGED
@@ -22,6 +22,10 @@ Please see the [project documentation](https://socketry.github.io/memory-profile
22
22
 
23
23
  Please see the [project releases](https://socketry.github.io/memory-profiler/releases/index) for all releases.
24
24
 
25
+ ### v1.1.15
26
+
27
+ - Ignore `freeobj` for classes that are not being tracked.
28
+
25
29
  ### v1.1.14
26
30
 
27
31
  - Ignore `freeobj` events for objects with anonymous classes that are not tracked (and thus become `T_NONE`).
@@ -66,10 +70,6 @@ Please see the [project releases](https://socketry.github.io/memory-profiler/rel
66
70
  - Better state handling and object increment/decrement counting.
67
71
  - Better call tree handling - including support for `prune!`.
68
72
 
69
- ### v1.1.5
70
-
71
- - Use queue for `newobj` too to avoid invoking user code during object allocation.
72
-
73
73
  ## Contributing
74
74
 
75
75
  We welcome contributions to this project.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v1.1.15
4
+
5
+ - Ignore `freeobj` for classes that are not being tracked.
6
+
3
7
  ## v1.1.14
4
8
 
5
9
  - Ignore `freeobj` events for objects with anonymous classes that are not tracked (and thus become `T_NONE`).
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memory-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.14
4
+ version: 1.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file