File tree Expand file tree Collapse file tree 2 files changed +45
-6
lines changed Expand file tree Collapse file tree 2 files changed +45
-6
lines changed Original file line number Diff line number Diff line change @@ -573,12 +573,8 @@ void php_oci_column_hash_dtor(zval *data)
573
573
zend_list_close (column -> stmtid );
574
574
}
575
575
576
- if (column -> descid ) {
577
- if (GC_REFCOUNT (column -> descid ) == 1 )
578
- zend_list_close (column -> descid );
579
- else {
580
- GC_DELREF (column -> descid );
581
- }
576
+ if (column -> descid && !GC_DELREF (column -> descid )) {
577
+ zend_list_free (column -> descid );
582
578
}
583
579
584
580
if (column -> data ) {
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug GH-4 (Memory leak with long query/CLOB) with OCI_RETURN_LOBS
3
+ --EXTENSIONS--
4
+ oci8
5
+ --SKIPIF--
6
+ <?php
7
+ require_once 'skipifconnectfailure.inc ' ;
8
+ ?>
9
+ --FILE--
10
+ <?php
11
+
12
+ require __DIR__ .'/connect.inc ' ;
13
+
14
+ $ expectedStr = str_repeat ('a ' , 1_001 );
15
+ $ sql = 'select concat(TO_CLOB( \'' . str_repeat ('a ' , 1_000 ) . '\'), TO_CLOB( \'a \')) AS "v" from "DUAL" ' ;
16
+
17
+ $ memUsages = array_flip (range (0 , 100 - 1 ));
18
+ foreach (array_keys ($ memUsages ) as $ k ) {
19
+ $ stid = oci_parse ($ c , $ sql );
20
+ oci_execute ($ stid );
21
+ $ row = oci_fetch_array ($ stid , \OCI_ASSOC | \OCI_RETURN_LOBS );
22
+ $ res = $ row ['v ' ];
23
+ if ($ res !== $ expectedStr ) {
24
+ var_dump ([$ expectedStr , $ res ]);
25
+ throw new \Exception ('unexpected result ' );
26
+ }
27
+
28
+ $ memUsages [$ k ] = memory_get_usage ();
29
+ }
30
+
31
+ $ memUsages = array_slice ($ memUsages , 1 , null , true );
32
+ $ memUsages = array_unique ($ memUsages );
33
+
34
+ if (count ($ memUsages ) !== 1 ) {
35
+ var_dump ($ memUsages );
36
+ throw new \Exception ('memory leak detected ' );
37
+ }
38
+
39
+ echo "ok \n" ;
40
+
41
+ ?>
42
+ --EXPECTF--
43
+ ok
You can’t perform that action at this time.
0 commit comments