Closed Bug 1147680 Opened 9 years ago Closed 9 years ago

Consider using PR_MemMap when deserializing heap snapshots

Categories

(DevTools :: Memory, defect)

x86
macOS
defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
Firefox 41
Tracking Status
firefox41 --- fixed

People

(Reporter: fitzgen, Assigned: fitzgen)

References

Details

Attachments

(1 file)

> ::: toolkit/devtools/server/ChromeUtils.cpp
> @@ +425,5 @@
> > +
> > +  uint32_t bytesRead = 0;
> > +  while (bytesRead < size) {
> > +    uint32_t bytesLeft = size - bytesRead;
> > +    int32_t bytesReadThisTime = PR_Read(fd, buffer.get() + bytesRead, bytesLeft);
> 
> For the future: there is a PR_MemMap.
Depends on: 1024774
Assignee: nobody → nfitzgerald
Attachment #8614945 - Flags: review?(jimb)
Comment on attachment 8614945 [details] [diff] [review]
Use PR_MemMap when deserializing heap snapshots

Review of attachment 8614945 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/devtools/server/AutoMemMap.h
@@ +32,5 @@
> +{
> +  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
> +
> +  PRFileInfo64 fileInfo;
> +  PRFileDesc*  fd;

Just curious, does NSPR actually require you to keep fd open while the memory is mapped? On POSIX, at least, you can map the file, and then close the fd, and the mapping holds its own reference to the file that is automatically dropped when the memory is freed. If NSPR works this way, then we could open the fd in init, do the mapping, and then close it. No need to keep it around.
Attachment #8614945 - Flags: review?(jimb) → review+
https://hg.mozilla.org/mozilla-central/rev/ddadcaa630f0
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: