Consider using PR_MemMap when deserializing heap snapshots

RESOLVED FIXED in Firefox 41

Status

()

Firefox
Developer Tools: Memory
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: fitzgen, Assigned: fitzgen)

Tracking

unspecified
Firefox 41
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(firefox41 fixed)

Details

Attachments

(1 attachment)

> ::: 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
Created attachment 8614945 [details] [diff] [review]
Use PR_MemMap when deserializing heap snapshots
Attachment #8614945 - Flags: review?(jimb)

Comment 2

3 years ago
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
Last Resolved: 3 years ago
status-firefox41: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
You need to log in before you can comment on or make changes to this bug.