PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/good/ext/exif/tests/bug68799.php

http://github.com/facebook/hiphop-php
PHP | 34 lines | 23 code | 8 blank | 3 comment | 1 complexity | 18b5835859f94bea93352bed69776b82 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?hh
  2. /*
  3. * * Pollute the heap. Helps trigger bug. Sometimes not needed.
  4. * */
  5. class A {
  6. function __construct() {
  7. $a = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa';
  8. $this->a = $a . $a . $a . $a . $a . $a;
  9. }
  10. };
  11. function doStuff ($limit) {
  12. $a = new A;
  13. $b = darray[];
  14. for ($i = 0; $i < $limit; $i++) {
  15. $b[$i] = clone $a;
  16. }
  17. unset($a);
  18. gc_collect_cycles();
  19. }
  20. <<__EntryPoint>> function main(): void {
  21. $iterations = 3;
  22. doStuff($iterations);
  23. doStuff($iterations);
  24. gc_collect_cycles();
  25. print_r(exif_read_data(__DIR__.'/bug68799.jpg'));
  26. }