试着在Chrome开发者工具中了解堆分析器.我在快照中看到几个可到达的对象,其中一些有黄色背景,有些没有.这是什么意思?有什么不同?
在这种情况下,颜色图例并不完全有用,因为它本身具有黄色背景(wtf).

我有一个表"课",它与表"学生"和"老师"相关联.通过外围关键关系将"班级"与多个学生和教师联系起来.
当我使用hibernate关联并获取大量实体(尝试5000)时,我发现它占用的内存比使用外键占位符的内存多4倍.hibernate关联有什么问题吗?
我可以使用任何内存分析器来找出使用太多内存的内容吗?
这是架构的方式:
class(id,className)
student(id,studentName,class_id)
teacher(id,teacherName,class_id)
class_id is foreign key..
Run Code Online (Sandbox Code Playgroud)
案例#1 - Hibernate协会
1)在班级实体中,将学生和教师映射为:
@Entity
@Table(name="class")
public class Class {
private Integer id;
private String className;
private Set<Student> students = new HashSet<Student>();
private Set<Teacher> teachers = new HashSet<Teacher>();
@OneToMany(fetch = FetchType.EAGER, mappedBy = "classRef")
@Cascade({ CascadeType.ALL })
@Fetch(FetchMode.SELECT)
@BatchSize(size=500)
public Set<Student> getStudents() {
return students;
}
Run Code Online (Sandbox Code Playgroud)
2)在学生和老师中,映射类为:
@Entity
@Table(name="student")
public class Student {
private Integer id;
private String studentName;
private Class classRef;
@ManyToOne
@JoinColumn(name = "class_id")
public Class getClassRef() …Run Code Online (Sandbox Code Playgroud) 从 Haskell 程序生成类型堆配置文件 (-hy) 时,我得到以下结果:
ReaderT
->ReadertT
->>*
(,)
->(#,#)
Run Code Online (Sandbox Code Playgroud)
这里的“->”前缀(带有一个或多个“>”)、“*”或“#”是什么意思?
当我使用-hy标志(用于类型描述)来分析程序的堆使用情况时,例如
./prog +RTS -hy
Run Code Online (Sandbox Code Playgroud)
常常看到->a,->>a,->>>a在结果(其中,a或者是另一种类型的或*)。这是什么意思?
我正在尝试分析一个用go写的应用程序,它显然使用了大约256个虚拟内存(使用后检查ps aux).我正在尝试使用pprof包,看看哪些函数分配/消耗了大部分内存,但结果对我来说毫无意义.pprof top似乎只列出运行时函数.有人可以帮我理解这些数据吗?
ps aux |grep android
root 4584 3.4 0.1 500244 29536 pts/1 Sl+ 17:21 0:38 ./android -logtostderr
Run Code Online (Sandbox Code Playgroud)
go tool pprof http:// localhost:6060/debug/pprof/heap
/pprof.localhost:6060.inuse_objects.inuse_space.008.pb.gz
Entering interactive mode (type "help" for commands)
(pprof) top
512.19kB of 512.19kB total ( 100%)
Dropped 19 nodes (cum <= 2.56kB)
flat flat% sum% cum cum%
512.19kB 100% 100% 512.19kB 100% runtime.malg
0 0% 100% 512.19kB 100% runtime.mcommoninit
0 0% 100% 512.19kB 100% runtime.mpreinit
0 0% 100% 512.19kB 100% …Run Code Online (Sandbox Code Playgroud) 当我使用pprof配置堆时,我得到以下内容:
但是,我不清楚如何解释这种可视化.特别是:
"箭头旁边的记忆意味着_____并且盒子里面的记忆意味着______.所以当一个盒子里有多个箭头时,它意味着_____,当它有多个箭头时,就意味着_____".
我正在尝试使用pprof来验证内存泄漏.
可以解释如何读取您在以下位置找到的堆配置文件:
http://localhost:6060/debug/pprof/heap?debug=1
此外,通过web在启动go tool pprof http://localhost:6060/debug/pprof/heap它之后键入命令产生一个空的.svg文件是正常的吗?
非常感谢
我正在使用异步套接字使用 MSDN 文档在客户端和服务器之间建立连接:
https://msdn.microsoft.com/en-us/library/fx6588te(v=vs.100).aspx
https://msdn.microsoft.com/en-us/library/bew39x2a(v=vs.100).aspx
我开始使用同步,后来使用异步。成功完成第一个应用程序后,我开始在 GitHub 存储库中搜索更多代码和更多解释。我找到了这个:
https://github.com/perrybutler/csharpsockets
没关系,它可以工作,但是它有内存泄漏,我开始分析,我发现了这一点:
(可能存在内存泄漏)
(随处可见 Cycle Detected 语句。我不知道它们的意思。我想应用程序或 GC 强制它停止并将其标记为 Cycle)。
我认为有些问题,因为如果你发送 1MB 的数据,内存应该只增加 1MB,但后来会减少。但这并没有发生。我开始在不引发异常的情况下处理所有内容,但这并没有多大帮助。
我开始在 StackOverflow 和其他地方搜索这个,我发现了这个:
但是,我不太明白那里正在讨论什么。
我还发现了这个:
https://www.codeproject.com/Articles/83102/C-SocketAsyncEventArgs-High-Performance-Socket-Cod
我读到套接字需要确认何时已经在 BeginSend/EndSend 和 BeginReceive/EndReceive 之间发送数据,因为如果没有,它将等待这一点,并开始增加内存(直到检测到周期?)
也许通过我分享的 CodeProject 我应该得到这个?我不知道,我必须从哪里开始。
我需要一个指南。我将尝试分析 CodeProject。
我使用正交投影制作了地图,并尝试提高性能,因为旋转不平滑(大约 6-7FPS)。
这是一张用 topojson 文件 (world-100m) 构建的世界地图。我需要与 country 进行交互并对它们进行着色,因此svg:path 与 countries 的数量一样多。
加载后,我使用 d3.timer 启动了自动旋转功能:
autoRotate = () =>
@start_time = Date.now() # Store the current time (used by automatic rotation)
d3.timer () =>
dt = Date.now() - @start_time
if @stopRotation or dt > @config.autoRotationDuration
true
else
@currentRotation[0] = @currentRotation[0] - @config.autoRotationSpeed
@projection.rotate @currentRotation
redrawPathsOnRotationOrScale(@currentRotation, @projection.scale())
false
redrawPathsOnRotationOrScale = (rotation, scale, duration = 1) =>
@currentRotation = rotation
@projection
.rotate(@currentRotation)
.scale(scale)
@groupPaths.selectAll("path")
.attr("d", path)
Run Code Online (Sandbox Code Playgroud)
为了理解为什么它这么慢,我在 Chrome 中做了一个配置文件记录,结果如下:

似乎 …
我一直在尝试分析用 cobra 构建的 cli 工具的堆使用情况。该pprof工具显示如下,
Flat Flat% Sum% Cum Cum% Name Inlined?
1.58GB 49.98% 49.98% 1.58GB 49.98% os.ReadFile
1.58GB 49.98% 99.95% 1.58GB 50.02% github.com/bytedance/sonic.(*frozenConfig).Unmarshal
0 0.00% 99.95% 3.16GB 100.00% runtime.main
0 0.00% 99.95% 3.16GB 100.00% main.main
0 0.00% 99.95% 3.16GB 100.00% github.com/spf13/cobra.(*Command).execute
0 0.00% 99.95% 3.16GB 100.00% github.com/spf13/cobra.(*Command).ExecuteC
0 0.00% 99.95% 3.16GB 100.00% github.com/spf13/cobra.(*Command).Execute (inline)
0 0.00% 99.95% 3.16GB 100.00% github.com/mirantis/broker/misc.ParseUcpNodesInspect
0 0.00% 99.95% 3.16GB 100.00% github.com/mirantis/broker/cmd.glob..func3
0 0.00% 99.95% 3.16GB 100.00% github.com/mirantis/broker/cmd.getInfos
0 0.00% 99.95% 3.16GB 100.00% …Run Code Online (Sandbox Code Playgroud) heap-profiling ×10
go ×4
pprof ×4
haskell ×2
memory-leaks ×2
performance ×2
c# ×1
d3.js ×1
ghc ×1
heap ×1
hibernate ×1
java ×1
javascript ×1
linux ×1
one-to-many ×1
profiling ×1
sockets ×1
types ×1