Unity: Could not allocate memory: System out of memory! Memorylabel Texture - unity3d

I know a lot of people get this issue but I have a hard time getting it fixed. Partly because this is my first Unity game.
So it is a 2d Android game using Unity 5.5.2f1 and I get the error when I try out my build. Note that this is my first build despite the game being 95% complete. I got stuck on building the APK for a while so I postponed fixing it. Building into an APK works fine but then when I run the game, after the intro screen the app crashes with the following debuglog (check note in the middle for where the crash occurs):
01-19 22:51:59.768: E/Unity(21604): Unable to find AudioPluginMsHRTF
01-19 22:51:59.769: E/Unity(21604): Unable to find
AudioPluginOculusSpatializer 01-19 22:51:59.848: D/Unity(21604):
GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor
GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker
GL_EXT_discard_framebuffer GL_EXT_robustness
GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV
GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture
GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync
GL_OES_EGL_image_external GL_OES_element_index_uint
GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high
GL_OES_get_program_binary GL_OES_packed_depth_stencil
GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8
GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float
GL_OES_texture_half_float GL_OES_texture_half_float_linear
GL_OES_texture_npot GL_OES_vertex_half_float
GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object
GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control
GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2
GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB
GL_EXT_sRGB_write_control GL_EXT 01-19 22:51:59.848: D/Unity(21604):
_texture_sRGB_decode GL_EXT_texture_filter_anisotropic GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float
GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query 01-19
22:52:00.564: W/Unity(21604): OnLevelWasLoaded was found on
GameManager 01-19 22:52:00.564: W/Unity(21604): This message has been
deprecated and will be removed in a later version of Unity. 01-19
22:52:00.564: W/Unity(21604): Add a delegate to
SceneManager.sceneLoaded instead to get notifications after scene
loading has completed 01-19 22:52:00.564: W/Unity(21604): 01-19
22:52:00.564: W/Unity(21604): (Filename: Line: 382)
when trying to transition from the scene 0 to scene 1
01-19 22:52:31.082: E/Unity(21604): Could not allocate memory: System
out of memory! 01-19 22:52:31.082: E/Unity(21604): Trying to allocate:
327716B with 16 alignment. MemoryLabel: Texture 01-19 22:52:31.082:
E/Unity(21604): Allocation happend at: Line:464 in 01-19
22:52:31.082: E/Unity(21604): Memory overview 01-19 22:52:31.082:
E/Unity(21604): [ ALLOC_DEFAULT ] used: 10185997B | peak: 10217647B |
reserved: 10604339B 01-19 22:52:31.082: E/Unity(21604): [
ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 524288B 01-19
22:52:31.082: E/Unity(21604): [ ALLOC_GAMEOBJECT ] used: 665219B |
peak: 665219B | reserved: 752068B 01-19 22:52:31.082: E/Unity(21604):
[ ALLOC_GFX ] used: 48855042B | peak: 50558706B | reserved: 48861160B
01-19 22:52:31.082: E/Unity(21604): [ ALLOC_PROFILER ] used: 0B |
peak: 0B | reserved: 0B 01-19 22:52:31.082: E/Unity(21604): [
ALLOC_TEMP_THREAD ] used: 110072B | peak: 0B | reserved: 2719744B
01-19 22:52:31.082: E/Unity(21604): 01-19 22:52:31.082:
E/Unity(21604): (Filename: Line: 996)
Now I have done the following:
-Made the intro screen as light as possible (at first I didn't even have one)
-Emptied the resource folder (cut my project size in half and increased build speed but that is about it)
-OpenGLES is set to 3 (someone advised this)
(note that there are no textures larger than 1000x1000)
As I said before, this is my first project in Unity. I am not the best programmer in the worl but over the last year I managed to put this little RPG together and I am quite ready to actually finish up and release! I would really appreciate any advise anyone can give!
Cheers,
Daan

Go to File > Build Settings and make sure Scripts Only Build is unchecked.
This has fixed it for me in Unity 2018.3.7f1.

Related

matlab : out of memory with convenable confi of pc

I block on my problem that I will wrote in details below. During 3 days I tried a lot of differents things, none worked..
If anyone have an idea of what to do !
Here is my message error :
the call to "ft_selectdata" took 0 seconds
preprocessing
Out of memory. Type "help memory" for your options.
Error in ft_preproc_dftfilter (line 187)
tmp = exp(2*1i*pi*freqs(:)*time); % complex sin and cos
Error in ft_preproc_dftfilter (line 144)
filt = ft_preproc_dftfilter(filt, Fs, Fl(i), 'dftreplace', dftreplace, 'dftbandwidth',
dftbandwidth(i), 'dftneighbourwidth', dftneighbourwidth(i)); % enumerate all options
Error in preproc (line 464)
dat = ft_preproc_dftfilter(dat, fsample, cfg.dftfreq, optarg{:});
Error in ft_preprocessing (line 375)
[dataout.trial{i}, dataout.label, dataout.time{i}, cfg] = preproc(data.trial{i}, data.label,
data.time{i}, cfg, begpadding, endpadding);
Error in EEG_Prosocial_script (line 101)
data_intpl = ft_preprocessing(cfg, allData_preprosses);
187 tmp = exp(2*1i*pi*freqs(:)*time); % complex sin and cos
There is some informations from matlab about my computer and about the caracteristics of the calcul
Maximum possible array: 7406 MB (7.766e+09 bytes)*
Memory available for all arrays: 7406 MB (7.766e+09 bytes) *
Memory used by MATLAB: 4195 MB (4.398e+09 bytes)
Physical Memory (RAM): 12206 MB (1.280e+10 bytes)
Limited by System Memory (physical + swap file) available.
K>> whos Name
Size Bytes Class Attributes
freqs 7753x1 62024 double
li 1x1 16 double complex
time 1x1984512 15876096 double
So there the config of the computer which failed to run the script (Alienware aurora R4) :
Ram : 4gb free / 12 # 1,6Ghz --> 2x (4Gb 1600Mhz) - 2x (2Gb 1600 MHz)
Intel core i7-3820 4 core 8 threads 3,7 GHz 1 CPU
NVIDIA GeForce GTX 690 2gb
RAM : Kingston KVT8FP HYC
Hard disk : SSD kingston 250Go SATA 3"
This code work on this computer (Dell inspiron 14-500) : config
Ram 4 Go of memory DDR4 2 666 MHz (4 Go x 1)
Intel® Core™ i5-8265U 8e generatio, (6 Mo memory, 3,9 GHz)
Intel® UHD Graphics 620
Hard disk SATA 2,5" 500 Go 5 400 tr/min
Thank you
Kind regards,
by doing freqs(:)*time you are trying to create a 7753*1984512 size array, and you dont have memory for that... (you will need ~123 gigabytes for that, or 1.2309e+11 bytes, where your computer has ~7e+09)
see for example the case for :
f=rand(7,1);
t=rand(1,19);
size(f(:)*t)
ans =
7 19
what you want do to is probably a for loop per time element etc.

java.lang.VerifyError: Uninitialized object exists on backward branch Kafka Win-10

I am facing an issue when starting Kafka server in my local machine (Windows 10) using the command
.\bin\windows\kafka-server-start.bat .\config\server.properties
I am getting the error shown below. I already have zookeeper server running.
[2020-07-27 16:08:05,144] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2020-07-27 16:08:05,394] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.VerifyError: Uninitialized object exists on backward branch 79
Exception Details:
Location:
scala/util/matching/Regex.unapplySeq(Lscala/util/matching/Regex$Match;)Lscala/Option; #126: goto
Reason:
Error exists in the bytecode
Bytecode:
0000000: 2bb6 00b5 c700 07b2 0080 b02b b600 b8b6
0000010: 00b9 2ab6 004b 4d59 c700 0b57 2cc6 000d
0000020: a700 752c b600 bd99 006e b200 3757 bb00
0000030: 5559 b200 5a57 2bb6 00be 3ebb 0060 59b7
0000040: 0064 3a04 1904 1db9 006a 0200 0336 0515
0000050: 051d a200 2f2b 1505 0460 b600 bf3a 0819
0000060: 0801 3a08 3a07 1907 013a 073a 0619 0419
0000070: 06b6 0072 5701 3a06 1505 0460 3605 a7ff
0000080: d119 04b9 0076 0100 c000 7801 3a04 013a
0000090: 06b7 007b b02a 2bb6 00b5 b600 c1b0
Stackmap Table:
same_frame(#11)
full_frame(#35,{Object[#2],Object[#24],Object[#62]},{Object[#62]})
same_frame(#42)
full_frame(#79,{Object[#2],Object[#24],Object[#62],Integer,Object[#96],Integer},{Uninitialized[#46],Uninitialized[#46]})
full_frame(#129,{Object[#2],Object[#24],Object[#62],Integer,Object[#96],Integer},{Uninitialized[#46],Uninitialized[#46]})
chop_frame(#149,3)
at scala.collection.StringOps$.r$extension(StringOps.scala:843)
at kafka.cluster.EndPoint$.<clinit>(EndPoint.scala:29)
at kafka.server.Defaults$.<clinit>(KafkaConfig.scala:79)
at kafka.server.KafkaConfig$.<clinit>(KafkaConfig.scala:961)
at kafka.metrics.KafkaMetricsConfig.<init>(KafkaMetricsConfig.scala:33)
at kafka.metrics.KafkaMetricsReporter$.startReporters(KafkaMetricsReporter.scala:62)
at kafka.server.KafkaServerStartable$.fromProps(KafkaServerStartable.scala:33)
at kafka.Kafka$.main(Kafka.scala:68)
at kafka.Kafka.main(Kafka.scala)
Any ideas how to fix this?
There seems to be an issue with your JAVA_HOME environment variable. Make sure your JAVA_HOME has the path to your JRE (Java runtime environment) and not JDK (Java Development Kit).
Just to be on the safe side, not sure if it's actually causing an incompatibility consider using 1.8.0_241 for Scala supporting libraries.
e.g. my JAVA_HOME environment variable: C:\Program Files\Java\jre1.8.0_241

SRIO interface u-boot. Cannot read IO memory

I try running a srio interface on my p2020 custom board. I plug a FPGA board with srio firmware to SRIO1 and configure SRIO as a host.
In uboot_config
#define CONFIG_SRIO1 /* SRIO port 1 */
#define CONFIG_SYS_SRIO1_MEM_VIRT 0xC0000000
#define CONFIG_SYS_SRIO1_MEM_BUS 0xC0000000
#define CONFIG_SYS_SRIO1_MEM_PHYS CONFIG_SYS_SRIO1_MEM_BUS
#define CONFIG_SYS_SRIO1_MEM_SIZE 0x10000000 /* 256M */
in tlb.c
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO1_MEM_VIRT, CONFIG_SYS_SRIO1_MEM_PHYS,
MAS3_SX | MAS3_SW | MAS3_SR,
MAS2_I | MAS2_G,
0, 3, BOOKE_PAGESZ_256M, 1),
Try to read srio memory from u-boot
=> md.l 0xc0000000
c0000000:
p2020 is stucked.
I can watch a read request and read response on FPGA board.
Why I can't read a srio memory?
I set a gpio 'marks' for each Interrupt vector in start.S. When I try to read Srio memory, uboot is stacked. An interrupt doesn't occur. I cannot determine the cause of the error.
I tried to read the SRIO1 memory from linux
# devmem 0xc0000000 32
Disabling lock debugging due to kernel taint
Machine check in kernel mode.
Caused by (from MCSR=10008): Bus - Read Data Bus Error
Oops: Machine check, sig: 7 [#1]
SMP NR_CPUS=2 P2020 DS
Modules linked in:
CPU: 1 PID: 1578 Comm: devmem Tainted: G M 4.9.34 #28
task: eb161a80 task.stack: ef0ca000
NIP: 1000b5fc LR: 1000b510 CTR: c02e1108
MSR: 0202d000 <VEC,CE,EE,PR,ME> CR: 40000242 XER: 20000000
DEAR: b7e79000 ESR: 00000000
GPR00: 40000242 bfab4250 b7e81470 b7e79000 1000b510 40000242 b7e79000 b7d88444
GPR08: 0202d000 00000000 b7e79000 bfab4250 ef0ca000 100c8126 00000000 00000000
GPR16: 00000000 00000000 100a3560 100c0000 100c3fc5 00000000 100c0000 00000003
GPR24: 100c225c 100c0000 00000000 00001000 bfab4554 00000000 b7e79000 00000020
NIP [1000b5fc] 0x1000b5fc
LR [1000b510] 0x1000b510
Oops: Machine check, sig: 7 [#1]
arch/powerpc/kernel/traps.c +731
Machine check exception usually means a hardware problem. I connected the SRIO1 port to a SRIO2 of my p2020 (SRIO2 address starts at 0xd0000000)
# devmem 0xc0000000
0x00710002
# devmem 0xd0000000
0x00710002
It's work! I think, the problem in the FPGA board.

Finding the values of positive peaks in smooth wave form

This is some code I wrote to search for the peaks of a very clean (no noise) signal where fun is an array containing evenly sampled data of a sine wave.
J=[fun(1)];
K=[1];
count=1;
for i=2:1.0:(length(fun)-2)
if fun(i-1)<fun(i) && fun(i)>fun(i+1)
J=[J,fun(i+1)];
K=[K,count+1];
end
count=count+1;
end
Included below is the data that I am trying to process.
The code found the peaks at the 664th and 991st entry, but none of the ones in between. I wrote the same algorithm in c++ and got the same result, so it is an algorithm problem, not language specific.
Please help me find the error or give me another solution.
fun = -1*pi/180*[-90.15
-90.00
-89.70
-89.10
-88.50
-87.75
-86.70
-85.65
-84.30
-82.95
-81.45
-79.80
-78.15
-76.35
-74.55
-72.30
-70.20
-67.80
-65.40
-62.70
-60.00
-57.15
-54.30
-51.15
-48.00
-44.85
-41.40
-37.95
-34.50
-30.90
-27.30
-23.55
-19.80
-16.05
-12.15
-8.25
-4.95
-1.50
1.95
4.80
7.80
10.65
13.95
17.40
20.70
23.85
27.15
30.30
33.45
36.45
39.45
42.45
45.30
48.00
50.70
53.40
55.95
58.35
60.75
63.15
65.25
67.35
69.45
71.40
73.20
74.85
76.50
78.15
79.50
80.85
82.05
83.25
84.15
85.05
85.95
86.70
87.45
88.05
88.50
88.95
89.10
89.25
89.40
89.25
89.10
88.95
88.50
88.05
87.45
86.70
86.10
85.20
84.30
83.25
82.20
81.00
79.65
78.15
76.65
75.00
73.35
71.55
69.60
67.50
65.40
63.30
60.90
58.65
56.10
53.55
51.00
48.30
45.45
42.60
39.75
36.75
33.75
30.60
27.45
24.30
21.00
17.70
14.40
11.10
7.65
4.80
1.95
-0.90
-4.35
-7.65
-11.10
-14.85
-18.75
-22.35
-26.10
-29.70
-33.30
-36.75
-40.20
-43.50
-46.80
-49.95
-52.95
-55.95
-58.65
-61.35
-63.90
-66.45
-68.85
-70.95
-73.05
-75.00
-76.80
-78.45
-80.10
-81.60
-82.95
-84.15
-85.20
-86.10
-87.00
-87.60
-88.05
-88.50
-88.80
-88.80
-88.80
-88.80
-88.50
-88.05
-87.60
-87.00
-86.25
-85.50
-84.45
-83.25
-82.05
-80.55
-79.05
-77.40
-75.60
-73.65
-71.55
-69.45
-67.20
-64.65
-62.25
-59.55
-56.70
-53.85
-50.85
-47.70
-44.55
-41.25
-37.95
-34.50
-30.90
-27.30
-23.70
-19.95
-16.20
-12.45
-8.55
-5.25
-1.95
1.50
4.35
7.20
10.05
13.35
16.65
19.95
23.10
26.40
29.55
32.55
35.55
38.55
41.40
44.25
47.10
49.80
52.35
54.90
57.30
59.70
61.95
64.05
66.30
68.25
70.20
72.00
73.65
75.30
76.80
78.30
79.65
80.85
81.90
82.95
83.85
84.75
85.50
86.10
86.55
87.00
87.45
87.60
87.75
87.75
87.75
87.60
87.30
87.00
86.55
85.95
85.35
84.60
83.70
82.80
81.75
80.55
79.35
78.00
76.50
75.00
73.35
71.70
69.75
67.95
65.85
63.75
61.50
59.25
56.85
54.45
51.90
49.35
46.65
43.80
40.95
38.10
35.10
32.10
28.95
25.95
22.65
19.50
16.20
13.05
9.75
6.90
4.05
1.05
-1.80
-5.10
-8.40
-11.70
-15.45
-19.20
-22.95
-26.55
-30.15
-33.60
-37.05
-40.35
-43.65
-46.80
-49.95
-52.80
-55.65
-58.50
-61.05
-63.60
-66.00
-68.25
-70.50
-72.45
-74.40
-76.20
-77.85
-79.35
-80.70
-81.90
-83.10
-84.15
-85.05
-85.80
-86.40
-86.85
-87.15
-87.45
-87.45
-87.45
-87.30
-87.00
-86.55
-85.95
-85.35
-84.45
-83.55
-82.50
-81.30
-79.95
-78.45
-76.95
-75.15
-73.35
-71.40
-69.30
-67.05
-64.65
-62.25
-59.70
-57.00
-54.15
-51.30
-48.30
-45.15
-41.85
-38.55
-35.25
-31.80
-28.20
-24.60
-21.00
-17.25
-13.65
-9.90
-6.60
-3.30
0.15
2.85
5.70
8.55
11.40
14.70
17.85
21.15
24.30
27.45
30.45
33.45
36.45
39.30
42.15
44.85
47.70
50.25
52.80
55.20
57.60
59.85
62.10
64.20
66.30
68.10
70.05
71.70
73.35
75.00
76.35
77.70
79.05
80.25
81.30
82.20
83.10
83.85
84.45
85.05
85.50
85.95
86.10
86.40
86.40
86.40
86.25
86.10
85.65
85.35
84.75
84.15
83.40
82.65
81.75
80.70
79.50
78.30
77.10
75.60
74.10
72.45
70.80
69.00
67.05
65.10
63.15
60.90
58.65
56.40
54.00
51.45
48.90
46.20
43.50
40.65
37.80
34.95
31.95
28.95
25.80
22.65
19.50
16.35
13.05
9.90
7.05
4.20
1.35
-1.50
-4.65
-7.95
-11.25
-15.00
-18.75
-22.35
-25.95
-29.40
-32.85
-36.30
-39.60
-42.75
-45.90
-49.05
-51.90
-54.75
-57.45
-60.15
-62.55
-64.95
-67.20
-69.30
-71.40
-73.20
-75.00
-76.65
-78.15
-79.50
-80.70
-81.90
-82.80
-83.70
-84.45
-85.05
-85.50
-85.80
-85.95
-86.10
-86.10
-85.80
-85.50
-85.05
-84.60
-83.85
-82.95
-82.05
-81.00
-79.65
-78.30
-76.95
-75.30
-73.65
-71.70
-69.75
-67.65
-65.40
-63.15
-60.60
-58.05
-55.35
-52.50
-49.65
-46.65
-43.50
-40.35
-37.05
-33.60
-30.15
-26.70
-23.10
-19.50
-15.90
-12.15
-8.55
-5.25
-1.95
1.35
4.05
6.90
9.75
12.45
15.75
18.90
22.05
25.05
28.20
31.20
34.20
37.05
39.90
42.60
45.30
48.00
50.55
53.10
55.35
57.75
60.00
62.10
64.20
66.15
67.95
69.75
71.40
73.05
74.55
75.90
77.10
78.30
79.50
80.55
81.30
82.20
82.95
83.55
84.00
84.45
84.75
84.90
85.05
85.05
84.90
84.75
84.45
84.15
83.55
83.10
82.35
81.60
80.70
79.65
78.60
77.55
76.20
74.85
73.35
71.85
70.20
68.40
66.60
64.65
62.55
60.45
58.35
55.95
53.70
51.15
48.75
46.05
43.35
40.65
37.80
34.95
32.10
29.10
25.95
22.95
19.80
16.65
13.50
10.20
7.05
4.20
1.50
-1.35
-4.50
-7.80
-11.10
-14.70
-18.30
-21.90
-25.50
-28.95
-32.40
-35.70
-39.00
-42.15
-45.30
-48.30
-51.15
-54.00
-56.70
-59.25
-61.65
-64.05
-66.30
-68.40
-70.35
-72.30
-73.95
-75.60
-77.10
-78.45
-79.65
-80.70
-81.60
-82.50
-83.10
-83.70
-84.15
-84.45
-84.60
-84.75
-84.60
-84.45
-84.15
-83.70
-83.10
-82.35
-81.45
-80.55
-79.35
-78.15
-76.80
-75.30
-73.65
-72.00
-70.05
-68.10
-66.00
-63.75
-61.35
-58.95
-56.40
-53.70
-50.85
-47.85
-44.85
-41.85
-38.70
-35.40
-32.10
-28.65
-25.05
-21.60
-18.00
-14.40
-10.80
-7.05
-3.90
-0.60
2.55
5.40
8.10
10.95
14.10
17.25
20.25
23.40
26.40
29.40
32.40
35.25
38.10
40.95
43.65
46.20
48.75
51.30
53.70
55.95
58.20
60.30
62.40
64.35
66.30
68.10
69.75
71.40
72.90
74.25
75.60
76.80
77.85
78.90
79.80
80.70
81.45
82.05
82.50
82.95
83.25
83.55
83.70
83.70
83.70
83.55
83.25
82.95
82.50
81.90
81.30
80.55
79.65
78.75
77.70
76.50
75.30
73.95
72.45
70.95
69.30
67.65
65.85
63.90
61.95
59.85
57.60
55.35
53.10
50.70
48.15
45.60
42.90
40.20
37.50
34.65
31.80
28.80
25.80
22.80
19.65
16.65
13.50
10.20
7.05
4.35
1.65
-1.20
-4.35
-7.50
-10.80
-14.40
-18.00
-21.45
-25.05
-28.50
-31.80
-35.10
-38.40
-41.55
-44.55
-47.55
-50.40
-53.25
-55.80
-58.35
-60.90
-63.15
-65.40
-67.35
-69.30
-71.25
-72.90
-74.55
-75.90
-77.25
-78.45
-79.50
-80.40
-81.30
-81.90
-82.50
-82.95
-83.25
-83.40
-83.40
-83.25
-83.10
-82.80
-82.35
-81.75
-81.00
-80.10
-79.05
-78.00
-76.65
-75.30
-73.80
-72.15
-70.50
-68.55
-66.60
-64.50
-62.25
-59.85
-57.30
-54.75
-52.05
-49.35
-46.35
-43.35
-40.35
-37.05
-33.90
-30.60
-27.15
-23.70
-20.25
-16.65
-13.05
-9.45
-6.30
-3.15
0.15
2.85
5.55
8.25
10.95
14.10
17.25
20.25
23.40
26.40
29.25
32.25
35.10
37.80
40.50
43.20
45.90
48.30
50.85
53.10
55.35
57.60
59.70
61.80
63.75
65.55
67.35
69.00
70.50
72.00
73.35
74.70
75.90
76.95
77.85
78.75
79.65
80.25
80.85
81.45
81.75
82.05
82.35
82.50
82.50
82.35
82.20
81.90
81.45
81.00
80.40
79.80
78.90
78.15
77.10
76.05
74.85
73.65
72.30
70.80
69.30
67.65
65.85
64.05
62.10
60.15
58.05
55.80
53.55
51.30
48.90
46.35
43.80
41.10
38.40
35.70
32.85
30.00
27.00
24.00
21.00
18.00
14.85
11.70
8.70
6.00
3.30
0.45
-2.25
-5.40
-8.55
-11.70
-15.30
-18.75
-22.20
-25.65
-29.10
-32.40
-35.70
-38.85
-41.85
-44.85
-47.85
-50.55
-53.25
-55.95
-58.35
-60.75
-63.00
-65.10
-67.05
-69.00
-70.80
-72.45
-73.95
-75.30
-76.50
-77.70
-78.75
-79.65
-80.40
-81.00
-81.45
-81.75
-82.05
-82.20
-82.05
-82.05
-81.75
-81.30
-80.70
-80.10];
Look at your data
First of all you should carefully look on your input data if your algorithm does not work as expected. Maybe it does what it is designed for but this is not what you expect. Some of your maxima are not clean local maxima. You have samples with exactly equal function values. I have drawn your data and magnified the first maximum to demonstrate it:
There are four values at index 165 to 169 that have identical numerical values. Your algorithm can not recognize a maximum of this shape.
Solutions
I have three suggestions for you.
Add precision to your data
Firstly: Look deeper in your data. They may have more precision if you take all significant digits. With a closer look your peaks might have real local maxima.
Don't re-invent the wheel
If you can solve it in matlab/octave you could just use an existing solution already able to deal with complicated situation as this:
[J,K]=findpeaks(fun,'DoubleSided')
This will give the expected result:
J =
-1.5603
1.5499
-1.5315
1.5263
-1.5080
1.5027
-1.4844
1.4792
-1.4608
1.4556
-1.4399
1.4347
K =
83
165
249
332
415
499
581
664
745
827
909
991
Use an improved algorithm
If you need to implement this method yourself you have to adapt your criterion for peak finding. For example you could use two single sided criteria and mark raising and falling and flat areas:
c(i)=1*(fun(i-1) < fun(i)) + -1*(fun(i+1) < fun(i))
This expression will produce in matlab/octave a 1 value for raising signal parts, 0 for flat parts and -1 for falling parts.
Now you can search this array for some conditions:
If you find a place without raise or fall after a raise and before falling signal you found a maximum. You also find a maximum if a fall follows a raise immediately.

Matlab R2012a crashes when trying 3D-graphics on Ubuntu 12.10

I'm having problems with my 3D-plotting on Ubuntu 12.10. The crash occurs immeadiately after I try to plot data in 3D. I have Crash dump and other error report here:
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/nouveau_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so
libGL error: dlopen /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so failed (/home/jonne/MATLAB/R2012a/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so))
libGL: OpenDriver: trying ${ORIGIN}/dri/tls/nouveau_dri.so
libGL: OpenDriver: trying ${ORIGIN}/dri/nouveau_dri.so
libGL error: dlopen ${ORIGIN}/dri/nouveau_dri.so failed (${ORIGIN}/dri/nouveau_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib/dri/tls/nouveau_dri.so
libGL: OpenDriver: trying /usr/lib/dri/nouveau_dri.so
libGL error: dlopen /usr/lib/dri/nouveau_dri.so failed (/usr/lib/dri/nouveau_dri.so: cannot open shared object file: No such file or directory)
libGL error: unable to load driver: nouveau_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: nouveau
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL error: dlopen /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so failed (/home/jonne/MATLAB/R2012a/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libLLVM-3.1.so.1))
libGL: OpenDriver: trying ${ORIGIN}/dri/tls/swrast_dri.so
libGL: OpenDriver: trying ${ORIGIN}/dri/swrast_dri.so
libGL error: dlopen ${ORIGIN}/dri/swrast_dri.so failed (${ORIGIN}/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/dri/swrast_dri.so
libGL error: dlopen /usr/lib/dri/swrast_dri.so failed (/usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
CRASH DUMP:
------------------------------------------------------------------------
Segmentation violation detected at Wed Dec 19 02:17:00 2012
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Current Visual : 0x21 (class 4, depth 24)
Default Encoding: UTF-8
GNU C Library : 2.15 stable
MATLAB Root : /home/jonne/MATLAB/R2012a
MATLAB Version : 7.14.0.739 (R2012a)
Operating System: Linux 3.5.0-19-generic #30-Ubuntu SMP Tue Nov 13 17:48:01 UTC 2012 x86_64
Processor ID : x86 Family 31 Model 6 Stepping 2, AuthenticAMD
Virtual Machine : Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (11300000), display :0.0
Fault Count: 1
Abnormal termination:
Segmentation violation
Register State (from fault):
RAX = 0000000000000000 RBX = 0000000000000000
RCX = 0000000000000000 RDX = 00007fb9ac068658
RSP = 00007fb9bb8e38e8 RBP = 00000000009a0005
RSI = 0000000000000000 RDI = 0000000000000000
R8 = 00007fb9ac068680 R9 = 0000000000000000
R10 = 0000000000000000 R11 = 0000000000000000
R12 = 0000000000001f02 R13 = 0000000000000000
R14 = 00007fb9c6b797d0 R15 = 0000000000000000
RIP = 00007fb973df6d00 EFL = 0000000000010206
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007fb9d09f592e /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwfl.so+00370990 _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+000158
[ 1] 0x00007fb9d09f87d0 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwfl.so+00382928
[ 2] 0x00007fb9d09f8b3b /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwfl.so+00383803 _ZN2fl4diag13terminate_logEPKcRKNS0_14thread_contextE+000171
[ 3] 0x00007fb9cf8dc203 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01253891 _ZN2fl4diag13terminate_logEPKcPK8ucontext+000067
[ 4] 0x00007fb9cf8d90fd /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01241341
[ 5] 0x00007fb9cf8da79d /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01247133
[ 6] 0x00007fb9cf8da925 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01247525
[ 7] 0x00007fb9cf8daf01 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01249025
[ 8] 0x00007fb9cf8db3f5 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01250293
[ 9] 0x00007fb9cdfa2cb0 /lib/x86_64-linux-gnu/libpthread.so.0+00064688
[ 10] 0x00007fb973df6d00 /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0+00056576 xcb_glx_get_string_string_length+000000
[ 11] 0x00007fb97c98a6b4 /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1+00272052 __glXGetString+000068
[ 12] 0x00007fb97c98812e /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1+00262446
[ 13] 0x00007fb97cbbf379 /home/jonne/MATLAB/R2012a/bin/glnxa64/glren.so+00078713
[ 14] 0x00007fb97cbb6b40 /home/jonne/MATLAB/R2012a/bin/glnxa64/glren.so+00043840
[ 15] 0x00007fb97cbb6cc6 /home/jonne/MATLAB/R2012a/bin/glnxa64/glren.so+00044230
[ 16] 0x00007fb9c68d30a8 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwhg.so+09408680 _Z22OpenGLSetupEnumstrOnceb+000296
[ 17] 0x00007fb9c6827ac7 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwhg.so+08706759 gf_DetermineBestRenderMode+000183
[ 18] 0x00007fb9c6827c0b /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwhg.so+08707083 _Z22gf_DetermineRenderModeP11GObject_tagi+000107
[ 19] 0x00007fb9c6827d0a /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwhg.so+08707338 InitializeFigureRenderEngine+000074
[ 20] 0x00007fb9c6828114 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwhg.so+08708372
[ 21] 0x00007fb9c689418c /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwhg.so+09150860
[ 22] 0x00007fb9c684a89b /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwhg.so+08849563 _Z24commitHG1DatabaseUpdatesb+000235
[ 23] 0x00007fb9d0157e16 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwservices.so+01359382 _Z26svWS_CommitDatabaseUpdates28svCommitDatabaseUpdatesType_+000390
[ 24] 0x00007fb9c5030387 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwuix.so+00525191
[ 25] 0x00007fb9c5030691 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwuix.so+00525969
[ 26] 0x00007fb9cfb476eb /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwbridge.so+00124651
[ 27] 0x00007fb9cfb47cde /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwbridge.so+00126174 _Z10ioReadLinebP8_IO_FILEPcS1_iPbRKN5boost8optionalIKP15inWorkSpace_tagEEb+000990
[ 28] 0x00007fb9cfb48165 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwbridge.so+00127333
[ 29] 0x00007fb9cfb4cd0a /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwbridge.so+00146698
[ 30] 0x00007fb9cfb4d165 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwbridge.so+00147813
[ 31] 0x00007fb9cfb4d9ce /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwbridge.so+00149966 mnParser+000702
[ 32] 0x00007fb9cf8c0de2 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01142242 _ZN11mcrInstance30mnParser_on_interpreter_threadEv+000034
[ 33] 0x00007fb9cf8a351a /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01021210
[ 34] 0x00007fb9cf8a3598 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01021336
[ 35] 0x00007fb9c5021376 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwuix.so+00463734
[ 36] 0x00007fb9c502b862 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwuix.so+00505954
[ 37] 0x00007fb9d01599a1 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwservices.so+01366433 _ZSt8for_eachIN9__gnu_cxx17__normal_iteratorIPN5boost8weak_ptrIN4sysq10ws_ppeHookEEESt6vectorIS6_SaIS6_EEEENS4_8during_FIS6_NS2_10shared_ptrIS5_EEEEET0_T_SH_SG_+000081
[ 38] 0x00007fb9d015aaab /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwservices.so+01370795
[ 39] 0x00007fb9d01585f9 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwservices.so+01361401 _Z25svWS_ProcessPendingEventsiib+000665
[ 40] 0x00007fb9cf8a276f /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01017711
[ 41] 0x00007fb9cf8a2c3b /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01018939
[ 42] 0x00007fb9cf8a2d97 /home/jonne/MATLAB/R2012a/bin/glnxa64/libmwmcr.so+01019287
[ 43] 0x00007fb9cdf9ae9a /lib/x86_64-linux-gnu/libpthread.so.0+00032410
[ 44] 0x00007fb9cdcc7cbd /lib/x86_64-linux-gnu/libc.so.6+00998589 clone+000109
Does anyone have any idea what should I do to get this work? 2D-plotting works, but 3D-does not...
Thank you!
What renderer are you using? Could you post a code snippet of your script?
Try creating the figure first, a specifying the renderer. For example,
figure('renderer','zbuffer')
I've had more luck with the zbuffer renderer than opengl or painters for example. In fact, in my startup script I've ensured every figure window that I open uses zbuffer - I've found it is much quicker to render, and has less problems with random crashes.
See: http://www.mathworks.com.au/help/matlab/ref/figure_props.html
Renderer
painters | zbuffer | OpenGL
Rendering method used for screen and printing. Selects the method used to render MATLAB graphics. The choices are:
painters — The original rendering method used by MATLAB is faster when the figure contains only simple or small graphics objects.
zbuffer — MATLAB draws graphics objects faster and more accurately because it colors objects on a per-pixel basis and MATLAB renders only those pixels that are visible in the scene (thus eliminating front-to-back sorting errors). Note that this method can consume a lot of system memory if MATLAB is displaying a complex scene.
OpenGL — OpenGL is a renderer that is available on many computer systems. This renderer is generally faster than painters or zbuffer and in some cases enables MATLAB to access graphics hardware that is available on some systems.
This helped me:
https://bbs.archlinux.org/viewtopic.php?id=154775
(...which got help from How to tell mex to link with the libstdc++.so.6 in /usr/lib instead of the one in the MATLAB directory?)
basically I just did this:
sudo mv /usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6 /usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6__bck
and
sudo ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6.0.17 /usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6