Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8236414

stringStream allocates on both ResourceArea and C-heap

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 15
    • hotspot
    • None

      stringStream implements ResourceObj and thus new() places it on the ResourceArea. The char* containing the printed content is allocated on the C heap.

      It is not desireable to allocate the char* on the ResourceArea as if it is resized under a deeper ResourceMark than that of the stringStream, the char* will be invalidated when leaving that deeper ResourceMark's scope. This led to various errors before.

      On the other side the fact that the destructor of stringStream must be called after allocating it with new() to free the char*, but delete() is not necessary/possible, is unexpected.

       

            Unassigned Unassigned
            goetz Goetz Lindenmaier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: